[Bug 10706] New: sh/ash is incorrectly parsing aritmetical expression

bugzilla at busybox.net bugzilla at busybox.net
Sun Jan 28 18:13:37 UTC 2018


https://bugs.busybox.net/show_bug.cgi?id=10706

            Bug ID: 10706
           Summary: sh/ash is incorrectly parsing aritmetical expression
           Product: Busybox
           Version: 1.27.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: petrcvekcz at gmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

My script keeps crashing in Busybox 1.27.2, so after some debugging I've
discovered this behaviour:

# sh
# XXX=-1
# echo $((0-$XXX))
sh: arithmetic syntax error
# echo $((0- $XXX))
1

In GNU bash 4.4.12(1)-release the same code works:

# sh
# XXX=-1
# echo $((0-$XXX))
1
# echo $((0- $XXX))
1

It seems to be general for expressions even without variables like $((0--1))
with those results:

# echo $((0--1))
-sh: arithmetic syntax error
# echo $((0-+1))
-1
# echo $((0+-1))
-1
# echo $((0++1))
-sh: arithmetic syntax error

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list