dash does not parse valid POSIX arithmetic
Bug #92189 reported by
Will Newton
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dash (Debian) |
Fix Released
|
Unknown
|
|||
dash (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Binary package hint: dash
This script:
cnt=6
while [ $((cnt = cnt - 1)) -gt 0 ]; do
echo $cnt
done
Is not parsed. Expansion and assignment in shell arithmetic appear to be mandated by the POSIX standard.
http://
"All changes to variables in an arithmetic expression shall be in effect after the arithmetic expansion, as in the parameter expansion "${x=value}".
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."
Changed in dash: | |
status: | Unconfirmed → Confirmed |
Changed in dash: | |
status: | Unknown → Confirmed |
Changed in dash: | |
importance: | Undecided → Medium |
Changed in dash: | |
status: | Confirmed → Fix Released |
To post a comment you must log in.
Now that dash is used for /bin/sh all my #!/bin/sh shell scripts are
breaking system-wide due to the failure of dash to properly expand $((x))
the same as $(($x)) as POSIX requires. I have a massive edit job to do
to change them all to work around this dash bug. Please do consider
this an important fix (or revert Ubuntu to using bash for /bin/sh for
a while longer until you do have time to fix dash).