Subject: Re: bug#16922: df --si -h should emit a warning

From: Bernhard Voelker <[email-masked]>
Date: Mon, 03 Mar 2014 09:00:39 +0100

On 03/03/2014 04:02 AM, Pádraig Brady wrote:
> Very few read info pages, and anyway in this case we should be clear at the man page level.
> 
> Mateusz stated the issue was that on a quick glance, the --si option wasn't described
> well enough in isolation. Likewise, the description of -h requires reading that of -H
> to know the power used. So hopefully the attached patch fixes this and more.

Hi Padraig,

great idea to use an example, thanks.
It's clearer than before:

  -h, --human-readable  print abbreviated sizes in powers of 1024 (e.g. 1023M)
  -H, --si              print abbreviated sizes in powers of 1000 (e.g. 1.1G)

However, I still see 2 problems:

a) The reader doesn't know the code, and therefore doesn't know
that both numbers originate from a calculation based on the same
number:

> +      const int example_size = 1023*1024*1024;

I would be good to let the user know that.

b) Both numbers are suffixed with the one-character notation (M,G),
i.e. comparing that to the explanation of these below in the usage
text, the reader may be confused again:

  SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
  are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

Well, in the texinfo manual, it's mentioned that `M' can stand both for
a mebibyte (in the -h case) as well as for a megabyte (in the -H case).
But somehow this is confusing: when used in SIZE, i.e. together with -B
as input option, then the user must use 'M' vs. 'MB' to make clear whether
to use powers of 1024 vs. 1000, while df(1) doesn't make that difference
in the output with -h vs. -H.

  $ src/df -h / | sed 1d
  /dev/sdb2        20G  8.7G   10G  47% /

  $ src/df -H / | sed 1d
  /dev/sdb2        22G  9.3G   11G  47% /

Shouldn't it say 22GB etc. in the latter -H case? And "1.1GB" in
the above usage text?  Now I'm confused, too ... ;-/
Monday morning syndrome?

Have a nice day,
Berny