Subject: bug#28152: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit

From: Michael Weiss <[email-masked]>
Date: Tue, 22 Aug 2017 00:56:09 +0200

On Sat, 19 Aug, 2017 at 14:09:00 -0700, Paul Eggert wrote:
> I'm afraid the problems would be more than minor, as other programs parse
> the output (there's an option in GNU 'sort' to do that, for example).

You're right, I was way too optimistic about this. But still, it could
be way worse imho.

> That being said, I could be talked into a patch like the one that
> Mihai Capotă suggested in:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=7176#11
> 
> as this would be upward-compatible. It would need documentation though.

Imho that patch would already be a great improvement but probably still
not enough.

If I didn't miss anything it would overwrite the default behaviour i.e.
if one would want to get the normal output one would have to execute
something like this: "env -u BLOCK_SIZE ls -l". The other problem would
be that the behaviour of -h and --si wouldn't change at all.

If one would like to change the default unit/format of the output (e.g.
via .bashrc) this would be great but unfortunately it wouldn't cover the
use case where one would like to use all binaries normally but get the
"human_B" output.

Do you think it would be possible to add another variable that wouldn't
overwrite the default but use the "human_B" output with -h or --si?

In that case one could set something like "HUMAN_B=true" and get the
following output:

$ du -s
116244	.

$ du -sh
114MiB	.

$ du -s --si
120MB	.

PS: Thanks for your fast reply (and sorry for my delay...).