Bug 1767 - expr in busybox can't handle math with big numbers
Summary: expr in busybox can't handle math with big numbers
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.1
Hardware: x86 Multiple
: Low normal
Target Milestone: 1.2 M2
Assignee: Andrei Gherzan
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2011-11-16 03:24 UTC by Gary Thomas
Modified: 2012-01-19 16:52 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Thomas 2011-11-16 03:24:54 UTC
Using the 'expr' program from busybox returns incorrect values:
  # ln -s /bin/busybox /tmp/expr
  # /tmp/expr 111517272011 - 111517292011                                                               
  0

Large numbers are supported:
  # /tmp/expr 111517272011
  111517272011

Math works, but only for smaller values:
  # /tmp/expr 65536 - 4
  65532

The 'expr' from coreutils works correctly
  # expr.coreutils 111517272011 - 111517292011
  -20000

I get the same results on ARM and PowerPC

Tested using master fa81f8dfb7a342e355b608aa4204cf23ed2b251c
Comment 1 Andrei Gherzan 2012-01-08 15:05:42 UTC
I compiled busybox on my machine and this bug is still present. So i think that this is a busybox bug and not a yocto one. You can test this by downloading source tar ball from upstream and:

~/Desktop/busybox-1.19.3 $ ./expr 111517272011 - 111517292011 
0
~/Desktop/busybox-1.19.3 $ ./expr 111517272011
111517272011
~/Desktop/busybox-1.19.3 $ ./expr 65536 - 4
65532
Comment 2 Andrei Gherzan 2012-01-08 15:58:38 UTC
(In reply to comment #1)
> I compiled busybox on my machine and this bug is still present. So i think that
> this is a busybox bug and not a yocto one. You can test this by downloading
> source tar ball from upstream and:
> 
> ~/Desktop/busybox-1.19.3 $ ./expr 111517272011 - 111517292011 
> 0
> ~/Desktop/busybox-1.19.3 $ ./expr 111517272011
> 111517272011
> ~/Desktop/busybox-1.19.3 $ ./expr 65536 - 4
> 65532

So the problem was around a busybox config. I will commit this change in order to fix this bug.

Edwin, you can assign this bug to me if you didn't already fix this.
Comment 5 Lauri Hintsala 2012-01-13 01:53:47 UTC
(In reply to comment #4)
> Fix:
> http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=91367de75575e79a94b2f90b6b7aa8740a039fc5

Sorry. My fix was for yocto time set issue, which was caused by this bug. You can forget my comment.