Bug 122043 - [patch] du(1) does not support byte-count-based reporting (-b argument)
Summary: [patch] du(1) does not support byte-count-based reporting (-b argument)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2008-03-24 09:10 UTC by Drkshadow
Modified: 2017-12-31 22:36 UTC (History)
0 users

See Also:

file.txt (4.12 KB, text/plain)
2008-03-24 09:10 UTC, Drkshadow
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Drkshadow 2008-03-24 09:10:02 UTC
du(1) that comes with FreeBSD does not understand the -b argument, and these is no way to achieve such functionality using the BLOCKSIZE environment variable. As far as I know, this option is not required by POSIX, but it's trivially implemented using a different member of the stat(2) structure and an if to separate block counts from byte counts.

The only issue that I can see is for filesystems containing files that sum up to more than 8 exabytes in size -- in this case, the 64-bit integer used to store the byte count will overflow. Multiply this by 512 for the maximum size for block-based counting. If it becomes an issue, a check can be put in to compare the addition and, if the result is less than the additive value, throw an error.

Fix: Patch attached with submission follows:
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:18 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped