dash as /bin/sh breaks POSIX 1003.1 scripts

Bug #118021 reported by Michael Zawrotny
2
Affects Status Importance Assigned to Milestone
dash (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: dash

On feisty, dash is installed with a symlink to /bin/sh. This breaks POSIX 1003.1 compliant scripts as
demonstrated below:

mez@jaguar{~}$ dash
$ x=3
$ echo $(( x + 4 ))
dash: arith: syntax error: " x + 4 "
$ echo $(( $x + 4 ))
7

As stated in the online version of 1003.1 (http://www.opengroup.org/onlinepubs/009695399/):
    If the shell variable x contains a value that forms a valid integer constant, then the arithmetic
    expansions "$((x))" and "$(($x))" shall return the same value.
dash clearly violates the standard here.

I have read all of the "bash vs dash" flame wars. This isnot about bash doing the right thing, but
about dash doing the wrong thing. This breaks, amongother things, the canonical use of
 "while getopts ..." followed by "shift $((OPTIND - 1))" as recommended by many books stressing
POSIX scripting.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.