bug#1115: [BusyBox] bug#1115: ls reports file sizes half what it should

Mark Whitley markw at lineo.com
Fri Mar 2 18:42:18 UTC 2001


On Thu, Mar 01, 2001 at 08:45:07PM -0600, David Douthitt wrote:
> Package: busybox
> Version: 0.50pre
> 
> This version reports file sizes half what it should, and half of what
> GNU ls and busybox 0.49 ls said.  The included patch fixes that...
> --- ls.c	Thu Mar  1 20:41:35 2001
> +++ ls.new.c	Thu Mar  1 20:21:37 2001
> @@ -650,9 +650,9 @@
>  					fprintf(stdout, "%9s ", format(dn->dstat.st_size, ls_disp_hr));
>  #else
>  #if _FILE_OFFSET_BITS == 64
> -					printf("%9lld ", dn->dstat.st_size>>1);
> +					printf("%9lld ", dn->dstat.st_size);
>  #else
> -					printf("%9ld ", dn->dstat.st_size>>1);
> +					printf("%9ld ", dn->dstat.st_size);
>  #endif
>  #endif

GNU ls: [testbed]

$ ls -lh b*
-rw-r--r--    1 markw    users        1.3k Feb 20 11:39 basename.c
-rw-r--r--    1 markw    users        1.1k Mar  2 11:17 basename.o
-rwxr-xr-x    1 markw    users        152k Mar  2 11:18 busybox*
-rw-r--r--    1 markw    users        4.0k Mar  2 10:43 busybox.c
-rw-r--r--    1 markw    users        8.5k Mar  2 11:13 busybox.h
-rw-r--r--    1 markw    users         820 Mar  1 11:51 busybox.links
-rwxr-xr-x    1 markw    users         517 Jan 26 13:53 busybox.mkll*
-rw-r--r--    1 markw    users        6.2k Mar  2 11:18 busybox.o
-rwxr-xr-x    1 markw    users         309 Feb 20 11:39 busybox.sh*
-rw-r--r--    1 markw    users        1015 Feb 14 11:57 busybox.spec

Busybox ls before applying your patch:

$ ./busybox ls -lh b*
-rw-r--r--   1 markw    users        1.3k Feb 20 11:39 basename.c
-rw-r--r--   1 markw    users        1.1k Mar  2 11:17 basename.o
-rwxr-xr-x   1 markw    users      152.3k Mar  2 11:18 busybox    <-- * a bit off
-rw-r--r--   1 markw    users        4.0k Mar  2 10:43 busybox.c
-rw-r--r--   1 markw    users        8.5k Mar  2 11:13 busybox.h
-rw-r--r--   1 markw    users         820 Mar  1 11:51 busybox.links
-rwxr-xr-x   1 markw    users         517 Jan 26 13:53 busybox.mkll
-rw-r--r--   1 markw    users        6.2k Mar  2 11:18 busybox.o
-rwxr-xr-x   1 markw    users         309 Feb 20 11:39 busybox.sh
-rw-r--r--   1 markw    users        1015 Feb 14 11:57 busybox.spec


After applying your patch:

$ patch < ls3.patch 
patching file `ls.c'
$ make
[snip]

$ ./busybox ls -lh b*
-rw-r--r--   1 markw    users        1.3k Feb 20 11:39 basename.c
-rw-r--r--   1 markw    users        1.1k Mar  2 11:17 basename.o
-rwxr-xr-x   1 markw    users      152.3k Mar  2 11:38 busybox
-rw-r--r--   1 markw    users        4.0k Mar  2 10:43 busybox.c
-rw-r--r--   1 markw    users        8.5k Mar  2 11:13 busybox.h
-rw-r--r--   1 markw    users         820 Mar  1 11:51 busybox.links
-rwxr-xr-x   1 markw    users         517 Jan 26 13:53 busybox.mkll
-rw-r--r--   1 markw    users        6.2k Mar  2 11:18 busybox.o
-rwxr-xr-x   1 markw    users         309 Feb 20 11:39 busybox.sh
-rw-r--r--   1 markw    users        1015 Feb 14 11:57 busybox.spec


[Mark scratches head]

I'm sorry, I don't see what the problem is or what your patch buys us. Would
you mind posting a transcript of a shell session that shows wrong sizes being
reported between GNU ls and Busybox ls?

Thanks,


Mark Whitley
markw at lineo.com






More information about the busybox mailing list