dash arithmetic gets & operator wrong without whitespace
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dash (Arch Linux) |
New
|
Undecided
|
Unassigned | ||
dash (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: dash
Evaluation of arithmetic expressions such as $((255&255)) produce an incorrect result with dash.
$ /bin/dash
$ echo $((255&255))
55
$ echo $((255&127))
27
It seems to ignore the digit immediately after the & operator. With whitespace after the &, it works properly:
$ echo $((255& 255))
255
$ echo $((255& 127))
127
This proper behavior is also seen in bash (3.2-0ubuntu18), NetBSD ash (NetBSD 4.0), and dash-0.5.3-7 (Debian).
$ lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04
$ apt-cache policy dash
dash:
Installed: 0.5.4-8ubuntu1
Candidate: 0.5.4-8ubuntu1
Version table:
*** 0.5.4-8ubuntu1 0
500 http://
100 /var/lib/
This is fixed in dash-0.5.5 (and thus in karmic and later), with the following change: git.kernel. org/?p= utils/dash/ dash.git; a=commit; h=065c7bfc0cb92 8e9f51ee9597d41 d5604acff68a
http://
(which was actually six months prior to my bug report).