[Toybox] Fwd: [toybox] du for contribution

Rob Landley rob at landley.net
Sun Aug 26 19:34:17 PDT 2012


On 08/18/2012 09:10 PM, Kyungwan Han wrote:
> Dear Rob.
> 
> I forgot to ask your opinion about default block size in du.

Copying my reply to the list because it's of general interest.

> Linux core utility and busybox use 1024 bytes as default block size, but
> the standard uses 512 bytes as default.
> (link : http://pubs.opengroup.org/onlinepubs/009604499/utilities/du.html)
> So I use 512 bytes as default block size.

That's a tough one.

The way I handled the standard contradicting normal usage over in the
"df" command was to add a config symbol DF_PEDANTIC which added -P
(explicit standards compliance mode) and -k symbols. Looking back, I'm
not sure I'm entirely happy with that, and need to review it for SUSv4
(it was developed before the new standard came out in 2008).

What I might do is add a config symbol for non-posix behavior, so in the
case of df the default _without_ the config symbol would be 512 bytes,
and then the config symbol would change the default (and the output
format) but add -P to get the old behavior.

> I'd like to know your opinion.
> If I were wrong, I would modify it.
> Please let me know.

I merged what you had because it's good code. I may do a polishing pass
on it later, and will probably split the non-posix options out into
their own config symbol.

I think the best way to do it is to make the basic implementation be
"the non-stupid bits of posix", and then an additional config symbol
should go beyond posix where applicable. (Or fill in the actively stupid
bits, like the full horror of xargs whitespace parsing which I still
haven't implemented yet both because it's kind of horrible and because
-0 renders it obsolete, but Rich Felker wants it, so it's on my todo list.)

> Best Regards.
> Jason Kyungwan Han.

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.

 1346034857.0


More information about the Toybox mailing list