First, we have to make a distinction between the issues described here
which are POSIX and which mean that there is a bug in dash that should
be fixed, and those which are NOT POSIX, of which, contrary to the
assertion above, there are definitely some.  For example:

$ dash -c 'a=water;echo ${a:2:2}'
dash: Syntax error: Bad substitution

is not POSIX: POSIX does not define substring syntax.  Also:

$ dash -c 'echo $UID'
# no output. how on earth are we supposed to safely and portably get the UID?

POSIX does not define that the shell should set the UID variable.  You
have to use "id".

$ dash -c 'x="1 2"; local y=$x; echo $y'
local: 1: 2: bad variable name

I don't think "local" is defined in POSIX sh, although it appears dash
does try to implement it; if so it should be done right.

$ dash -c 'cnt=6; while [ $((cnt = cnt - 1)) -gt 0 ]; do echo $cnt; done'
dash: arith: syntax error: "cnt = cnt - 1"

I don't think assignment inside arithmetic expressions is defined in
POSIX.

The rest of these do appear to be bugs in dash, although technically the
POSIX spec only guarantees the shell to handle file descriptors 0-9 so
using any FD >9 is not, strictly, portable.

My opinion is that Ubuntu is 100% correct here: they should be using
POSIX shell scripts and any script that does not adhere to POSIX should
NOT start with #!/bin/sh.  Obviously where dash doesn't support POSIX
that's a bug in dash that needs to be fixed.

But, I hope Ubuntu will not bow down to this decade's version of "all
the world's a VAX" and make more true the maxim "every /bin/sh is bash".

Fight the good fight, Ubuntu!

-- 
dash as #!/bin/sh introduces countless incompatibilities
https://bugs.launchpad.net/bugs/141481
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to