[Bug 4435] listing of files in long format shows incorrect sizes

bugzilla at busybox.net bugzilla at busybox.net
Sat Nov 5 22:42:10 UTC 2011


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

--- Comment #9 from Denys Vlasenko <vda.linux at googlemail.com> 2011-11-05 22:42:10 UTC ---
(In reply to comment #8)
> Created attachment 3734 [details]
> Attached is the output from the debug statements that was asked to run
> 
> What I meant about the fix was I have changed the line,
> column += printf("%9"OFF_FMT"u ", dn->dn_size);
> to 
> column += printf("%9"OFF_FMT"u ", (unsigned long long) dn->dn_size);

If that change fixes the problem for you, it means that off_t (dn->dn_size has
this type) and OFF_FMT don't match. This means that not only ls will be
affected.

The problem seems to be that OFF_FMT string is "ll" but off_t is not "long
long".

Before we start digging deeper, let's confirm this. Add these lines at the
beginning of ls_main():

printf("sizeof(off_t):%d\n"    , (int) sizeof(off_t));
printf("sizeof(long long):%d\n", (int) sizeof(long long));
printf("sizeof(dn_size):%d\n"  , (int) sizeof( ((struct dnode*)NULL)->dn_size
));
printf("OFF_FMT:'"OFF_FMT"'\n");

recompile, run ls applet, and post the output of these four lines.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list