[BusyBox 0000136]: expr get weird results with long numbers

bugs at busybox.net bugs at busybox.net
Mon Jan 9 05:12:18 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=136 
====================================================================== 
Reported By:                dreamworks
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   136
Category:                   Other
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             03-08-2005 11:50 PST
Last Modified:              01-08-2006 21:12 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.) 

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                          
======================================================================




More information about the busybox-cvs mailing list