[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
'du -b' bug in fileutils-4.1
From: |
David Eisner |
Subject: |
'du -b' bug in fileutils-4.1 |
Date: |
Wed, 19 Feb 2003 18:46:08 -0500 (EST) |
Hi. I think there's a bug in the 'du' utility in fileutils-4.1.
du -b is supposed to report the size of the file in bytes.
The observed behavior is that du -b reports the size rounded
up to the nearest multiple of 1024, however:
venice[ /venice/cradle ]% ls -l file.dat
-rw-rw-r-- 1 cradle calce 417 Feb 19 18:29 file.dat
venice[ /venice/cradle ]% fileutils-4.1/bin/du -b file.dat
1024 file.dat
The expected behavior is that du -b report '417' as the size.
The problem seems to have been introduced in fileutils-4.0:
venice[ /venice/cradle ]% ls -l file.dat
-rw-rw-r-- 1 cradle calce 417 Feb 19 18:29 file.dat
venice[ /venice/cradle ]% fileutils-3.16/bin/du -b file.dat
417 file.dat
venice[ /venice/cradle ]% fileutils-4.0/bin/du -b file.dat
1024 file.dat
venice[ /venice/cradle ]% fileutils-4.1/bin/du -b file.dat
1024 file.dat
The problem is in the count_entry() function in du.c:
507
508 size = ST_NBLOCKS (stat_buf);
509 tot_size += size;
510
but in v3.16, we have:
514 if (output_size == size_bytes)
515 size = stat_buf.st_size;
516 else
517 size = ST_NBLOCKS (stat_buf);
518
519 tot_size += size;
Thanks.
-David
------------------------+--------------------------+
David Eisner | E-mail: address@hidden |
CALCE EPSC | Phone: 301-405-5341 |
University of Maryland | Fax: 301-314-9269 |
------------------------+--------------------------+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 'du -b' bug in fileutils-4.1,
David Eisner <=