[BusyBox 0000136]: expr get weird results with long numbers
bugs at busybox.net
bugs at busybox.net
Wed Jan 25 13:58:18 UTC 2006
The following issue has been RESOLVED.
======================================================================
http://busybox.net/bugs/view.php?id=136
======================================================================
Reported By: dreamworks
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 136
Category: Other
Reproducibility: always
Severity: feature
Priority: normal
Status: resolved
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 03-08-2005 11:50 PST
Last Modified: 01-25-2006 05:58 PST
======================================================================
Summary: expr get weird results with long numbers
Description:
hi guys,
i'm trying to use busybox within an ramdisk installer image and expr to do
some free disk space calculation... Seems to me that expr just works with
ints or at most unsigned ints... please be aware that modern hard drives
contain 120 GB which are a lot of bytes... (which can not be divided
within expr busybox)
Greetings from Germany
======================================================================
----------------------------------------------------------------------
landley - 12-07-05 22:08
----------------------------------------------------------------------
Looking at fixing this, but a reproduction test case would be good.
----------------------------------------------------------------------
dreamworks - 12-08-05 03:20
----------------------------------------------------------------------
ok, let's do it with a simple example:
(1) On current RHEL v4
mschoen at debug:/home/hindenburg/msc > expr 2147483647 + 1
2147483648
(2) within busybox
/ # /bin/expr 2147483647 + 1
-2147483648
So the bug is quite simple; the implementation uses unsigend int(32bit)
which is not sufficient for modern systems, e.g. take the example
mentioned above with size calculations for Installer Images with 120GByte
Hard disks.
----------------------------------------------------------------------
landley - 01-08-06 21:12
----------------------------------------------------------------------
This is really a feature request, and looking at expr it's fairly
intrusive. (All the code has to be changed from int to long long, and
that should really have a config option, and that should probably be a
larger "use 64 bit math on 32 bit platforms" config option of some kind,
and that's a design decision I'm putting off until at least 1.1.1.)
----------------------------------------------------------------------
landley - 01-08-06 21:14
----------------------------------------------------------------------
Ok that's really a feature request, one that's pretty intrusive in this
case (lots of individual "int" arguments need to be changed to "long long"
or a typedef alternating between the two based on a config option, and
there's a larger design issue that there should probably be some kind of
global config option "use 64 bit math on 32 bit platforms" rather than
just one for this app...
And in any case, I'm going to punt this past 1.1.0, which I'm trying to
get out tomorrow. Maybe 1.1.1...
----------------------------------------------------------------------
landley - 01-08-06 21:18
----------------------------------------------------------------------
I have no idea how to re-categorize a defect. (I really, really hate this
bug system.) "expr uses 32 bit math on a 32 bit processor" is not a
"severe defect" in an embedded system, it's a feature request for 64 bit
math which some people will _not_ want. If I can't figure out how to
recategorize, possibly I'll just close it out and either open a new one or
more likely just put it on my personal todo list. But I'd rather not...
----------------------------------------------------------------------
vodz - 01-25-06 05:58
----------------------------------------------------------------------
Ok. I added this as feature. See revision 13588.
Issue History
Date Modified Username Field Change
======================================================================
03-08-05 11:50 dreamworks New Issue
03-16-05 12:27 andersen Assigned To andersen => BusyBox
12-07-05 22:08 landley Note Added: 0000740
12-07-05 22:08 landley Status assigned => feedback
12-08-05 03:20 dreamworks Note Added: 0000745
01-08-06 21:12 landley Note Added: 0000880
01-08-06 21:14 landley Note Added: 0000881
01-08-06 21:14 landley Status feedback => assigned
01-08-06 21:18 landley Note Added: 0000882
01-25-06 05:58 vodz Note Added: 0000999
01-25-06 05:58 vodz Severity major => feature
01-25-06 05:58 vodz Status assigned => resolved
01-25-06 05:58 vodz Resolution open => fixed
======================================================================
More information about the busybox-cvs
mailing list