bug#1189: [BusyBox] bug#1189: make_human_readable_str chokes with big numbers (GB/TB values)

Erik Andersen andersen at lineo.com
Fri Jun 29 15:15:02 UTC 2001


On Fri Jun 29, 2001 at 04:45:27PM -0400, Adam Slattery wrote:
> 
> package: busybox
> version: 0.51
> (latest cvs Jun 29 06:00)
> 
> 
> busybox df -h (with the patch I just submitted for the blocksize bug):
>  /dev/ide/host0/bus0/target0/lun0/part2   inf   883M    983M  47%  /usr
> 
> fileutils df -h:
>  /dev/ide/host0/bus0/target0/lun0/part2   1.9G  883M    983M  47% /usr
> 
> This isn't good :).
> 
> The problem is that in human_readable.c, a 32 bit variable ends up getting
> shifted left 40 bits when you have a GB size.  The fix is to use a
> variable as big as the result size (long double). A small problem arrises:
> you can't bitshift long double on 32 bit archetectures. So instead we can
> just multiply and divide by 1024 (*1024 is the same as <<10).

but slower.  Actually, a while back we had a version of human_readable.c that
didn't need any floats at all.  Unfortunately, we had a very flawed interface
at the time that led to it being misused.  I was planning on resurrecting that
version and updating it to the current interface, but I just talked with Manuel
and it turns out he is already doing it.  So we should have that fixed up soon.

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--






More information about the busybox mailing list