[Bug 932067] [NEW] Minus associativity not correct in arithmetic expansions

Vadim Zeitlin 932067 at bugs.launchpad.net
Tue Feb 14 13:57:51 UTC 2012


Public bug reported:

It seems that arithmetic expansion is completely broken in dash
0.5.51-3ubuntu2 from 10.04.3 LTS:

% /bin/sh -c 'echo $((10-2-3))'              # ok so far
5
% /bin/sh -c 'echo $((10-2*0-3))'         # what??
13
% /bin/sh -c 'echo $((10-2*1-3))'        # it's not limited to factor being 0 neither
11

This can be worked around by using additional parentheses, e.g.

% /bin/sh -c 'echo $(((10-2*1)-3))'
5

FWIW the bug doesn't exist in dash 0.5.7-2 from Debian but I can't find
any mention of it being fixed in dash change log so I'm not sure whether
it's a dash bug or something Ubuntu-specific.

** Affects: dash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dash in Ubuntu.
https://bugs.launchpad.net/bugs/932067

Title:
  Minus associativity not correct in arithmetic expansions

Status in “dash” package in Ubuntu:
  New

Bug description:
  It seems that arithmetic expansion is completely broken in dash
  0.5.51-3ubuntu2 from 10.04.3 LTS:

  % /bin/sh -c 'echo $((10-2-3))'              # ok so far
  5
  % /bin/sh -c 'echo $((10-2*0-3))'         # what??
  13
  % /bin/sh -c 'echo $((10-2*1-3))'        # it's not limited to factor being 0 neither
  11

  This can be worked around by using additional parentheses, e.g.

  % /bin/sh -c 'echo $(((10-2*1)-3))'
  5

  FWIW the bug doesn't exist in dash 0.5.7-2 from Debian but I can't
  find any mention of it being fixed in dash change log so I'm not sure
  whether it's a dash bug or something Ubuntu-specific.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dash/+bug/932067/+subscriptions




More information about the foundations-bugs mailing list