severity 510354 wishlist
tags 510354 + upstream wontfix
quit

Hi Jamie,

Sorry for the long silence.

Jameson Graef Rollins wrote:

> servo:/tmp/cdtemp.XcoaZB 0$ cat ./foo
> #!/bin/sh
> read -p "test: " OK
> servo:/tmp/cdtemp.XcoaZB 0$ checkbashisms -p ./foo
> possible bashism in ./foo line 2 (should be read [-r] variable):
> read -p "test: " OK
> servo:/tmp/cdtemp.XcoaZB 1$ 
> 
> As far as I can tell, at least from the opengroup.org posting of the
> spec [0], this is in fact a bashism that is not POSIX compliant.  It
> is also not listed as an acceptable exception in Debian Policy 10.4.

I think you're right --- conforming applications cannot pass -p to the
read utility.  (Unfortunately that is unlikely to change because ksh
uses -p to mean something else.)

  "The read utility shall conform to XBD Utility Syntax Guidelines .

   The following option is supported:

   -r
      Do not treat a <backslash> character in any special way.
      Consider each <backslash> to be part of the input line."

Therefore dash can treat -p however it wants to, at least as far as
POSIX is concerned.

> I very much like having dash be a fully compliant POSIX shell.  If you
> believe that the -p option is compliant, then we should probably try
> to have it listed as such the Debian Policy manual, and make sure that
> checkbashisms does not flag it, so that things treat is consistently.

Have you tried posh?  dash includes some extensions consistent with
POSIX for the sake of convenience or compatibility with previous
releases when that does not bloat it too much.  posh ideally does not.

Thanks for the report,
Jonathan



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to