GNU bug report logs - #16922
df --si -h should emit a warning

Previous Next

Package: coreutils;

Reported by: Mateusz Jończyk <mat.jonczyk <at> o2.pl>

Date: Sun, 2 Mar 2014 14:16:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16922 in the body.
You can then email your comments to 16922 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Sun, 02 Mar 2014 14:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mateusz Jończyk <mat.jonczyk <at> o2.pl>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 02 Mar 2014 14:16:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mateusz Jończyk <mat.jonczyk <at> o2.pl>
To: bug-coreutils <at> gnu.org
Subject: df --si -h should emit a warning
Date: Sun, 02 Mar 2014 13:33:51 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
There should be a warning when running df --si -h because it will display results
in blocks of 1024 and not 1000, as one might think (the switch --si displays blocks
in a human-readable format when used by itself).

Greetings,
Mateusz Jończyk

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: My public key: 0x2C64C488 on hkp://pool.sks-keyservers.net
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTEyUvAAoJELLT9LcsZMSIbUAH/jqzwjVoHp3w6ud2cKnMw85x
J2MIPVXIUSHuVFL+0bMtiT8LqsLRJ4/FZtLr9GlNeNljuJ/cAclkUzFJXuuUO0Ci
feNPI1udsOslkvw8P1n6ghi1VaJOHy2qt9DegjDQOHhNNZRbMD7AYQBxneZ/VBbd
shptJoeqxg4GEQIXIZZN4rLQ5DKixIHoDPl/rrgxELIvepZY1MX5LK88w+ktagcA
Q0St5XmhYH4aTb5DhSuBRMeLWopTYfi2tEGUqKMD95IZ530YpL6W4DCWVh9N9wqI
enXxbIz+++YYCfjapzLihcSu30No6764nEruHWH6UsqGaJ8E/ClXUHSfqMfkoDI=
=78fV
-----END PGP SIGNATURE-----




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Sun, 02 Mar 2014 14:35:03 GMT) Full text and rfc822 format available.

Message #8 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Mateusz Jończyk <mat.jonczyk <at> o2.pl>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Sun, 02 Mar 2014 14:33:51 +0000
On 03/02/2014 12:33 PM, Mateusz Jończyk wrote:
> Hello,
> There should be a warning when running df --si -h because it will display results
> in blocks of 1024 and not 1000, as one might think (the switch --si displays blocks
> in a human-readable format when used by itself).

This is confusing.

I think the confusion stems from the option names themselves.
I.E. I'm not sure you'd want to warn as you might want to support overriding options.
Consider: alias df='df -h'

Then you could very well want to `df -H` to override the power from 1024 to 1000.

So really the option should be --human-si not just --si.

Also I notice that in GNU df, -h and -H are 1024 and 1000 based respectively,
whereas on FreeBSD it's the other way around :(

How about we just support --human-si and deprecate --si ?

thanks,
Pádraig.





Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Sun, 02 Mar 2014 17:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>, Mateusz Jończyk <mat.jonczyk <at> o2.pl>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Sun, 02 Mar 2014 18:38:06 +0100
On 03/02/2014 03:33 PM, Pádraig Brady wrote:
> On 03/02/2014 12:33 PM, Mateusz Jończyk wrote:
>> Hello,
>> There should be a warning when running df --si -h because it will display results
>> in blocks of 1024 and not 1000, as one might think (the switch --si displays blocks
>> in a human-readable format when used by itself).
> 
> This is confusing.

Indeed, or not ...

> I think the confusion stems from the option names themselves.
> I.E. I'm not sure you'd want to warn as you might want to support overriding options.
> Consider: alias df='df -h'
> 
> Then you could very well want to `df -H` to override the power from 1024 to 1000.

... because df really honors the last given option (as expected):

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

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

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

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

> So really the option should be --human-si not just --si.

Well, I'm 80:20 against this. Df(1) just honors the latest option
given - no matter what the name of the option's name is.  Renaming
an option is almost always a "suboptimal" thing for users.
In this case, some might be already used to type "df --human" which
would not be distinguishable from --human-si anymore.

The problem is maybe that "df --help" doesn't explicitly say that -h
is using powers of 1024 no matter what other option was given before.

  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024

However, the info page is quite clear about this:

  `-h'
  `--human-readable'
       Append a size letter to each size, such as `M' for mebibytes.
       Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes.
       This option is equivalent to `--block-size=human-readable'.  Use
       the `--si' option if you prefer powers of 1000.

> Also I notice that in GNU df, -h and -H are 1024 and 1000 based respectively,
> whereas on FreeBSD it's the other way around :(

Outch. ;-(

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Sun, 02 Mar 2014 18:08:02 GMT) Full text and rfc822 format available.

Message #14 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Mateusz Jończyk <mat.jonczyk <at> o2.pl>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Sun, 02 Mar 2014 19:07:52 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

W dniu 02.03.2014 15:33, Pádraig Brady pisze:
> On 03/02/2014 12:33 PM, Mateusz Jończyk wrote:
>> Hello, There should be a warning when running df --si -h because it will 
>> display results in blocks of 1024 and not 1000, as one might think (the
>> switch --si displays blocks in a human-readable format when used by itself).
> 
> This is confusing.
> 
> I think the confusion stems from the option names themselves. I.E. I'm not sure 
> you'd want to warn as you might want to support overriding options. Consider: 
> alias df='df -h'
> 
> Then you could very well want to `df -H` to override the power from 1024 to 
> 1000.
> 
> So really the option should be --human-si not just --si.
> 
> Also I notice that in GNU df, -h and -H are 1024 and 1000 based respectively, 
> whereas on FreeBSD it's the other way around :(
> 
> How about we just support --human-si and deprecate --si ?
There should probably be a warning in the documentation at --si.

I do not know what to think about the --human-si switch.
> 
> thanks, Pádraig.
> 


- --
Pozdrawiam,
Mateusz Jończyk
AEI, Informatyka, Semestr 2 Magisterskich, BDiIS

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: My public key: 0x2C64C488 on hkp://pool.sks-keyservers.net
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTE3N3AAoJELLT9LcsZMSIX90H/AkPy6z8MSDtKIi6JmkkABjI
k6ed81SO2H33XAU5agyGjxqlWvrKfo2Bl0Kxk0AJtoeTN74ENKTJvEmLDcnSJu48
90g4+91zRqv0+v+39OVqSrXK0kf2Sj+9Tg893Mw+tUsKHHEU3I82v9aTpHI8pFlY
4zHul7a+3GToD7EQbLX3ZPz15ehNJM9cLsrCKLsIoUBHQxhMXToL7ixhfm9D8PCY
moa3+mKg0T2zXGnTMjrHQs7YdBE95FI1MtA4upTXqJFIeyb0JhX5jUSX4HDbL6Ll
ln8iOQvU8cqv2Msa3qc2LcM939R8A32WChbP9L4gojpnGXB0NpX3reb6qcrm8/4=
=x3bk
-----END PGP SIGNATURE-----




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Sun, 02 Mar 2014 18:14:01 GMT) Full text and rfc822 format available.

Message #17 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Mateusz Jończyk <mat.jonczyk <at> o2.pl>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>, Pádraig Brady <P <at> draigBrady.com>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Sun, 02 Mar 2014 19:13:52 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

W dniu 02.03.2014 18:38, Bernhard Voelker pisze:
> The problem is maybe that "df --help" doesn't explicitly say that -h is using
> powers of 1024 no matter what other option was given before.
> 
> -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G) 
> -H, --si              likewise, but use powers of 1000 not 1024
> 
> However, the info page is quite clear about this:
> 
> `-h' `--human-readable' Append a size letter to each size, such as `M' for
> mebibytes. Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes. 
> This option is equivalent to `--block-size=human-readable'.  Use the `--si'
> option if you prefer powers of 1000.
> 
I did not read the full man page description, just found the header '--si' and
thought that it does just what the name says: switches the display powers from 1024
to 1000. It should probably be described earlier in the manpage.

- -- 
Pozdrawiam,
Mateusz Jończyk
AEI, Informatyka, Semestr 2 Magisterskich, BDiIS

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: My public key: 0x2C64C488 on hkp://pool.sks-keyservers.net
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTE3TfAAoJELLT9LcsZMSIolUH/jHyBgsBerTkkD1UF+HVGlpH
sAp/H3lS3syzpTVjOMrCmW6WtYAWWzpVbLXmHM4YLSX1U/kzE9RibfJ5inH+ZInT
Stllsi3Dkh0ACyPBQCEcAsILMzEnV+5Sxo+Qc9JP+PAQetQ1IbuFRRuPfh2TfFz7
1jUWWWeUDy20S7uUMb4Xew201VLdm4si+aaTn0dJV9Wl8pSC/ldbF6MOiYypJZji
D6obMcyzcofWNY2sNi2Jz9lxNBHGW7jG2Z0k4PUigGY4gLdG1aUfOzVc6n5DkT0x
A4hJzl1oIlvtr9RAVmrt7U7QA2oHgVmGzkuLEWSdgRoCh4ZGKAbqRyxHWSOu4d0=
=cwS7
-----END PGP SIGNATURE-----




Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Mon, 03 Mar 2014 03:03:02 GMT) Full text and rfc822 format available.

Notification sent to Mateusz Jończyk <mat.jonczyk <at> o2.pl>:
bug acknowledged by developer. (Mon, 03 Mar 2014 03:03:02 GMT) Full text and rfc822 format available.

Message #22 received at 16922-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: Mateusz Jończyk <mat.jonczyk <at> o2.pl>,
 16922-done <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 03:02:38 +0000
[Message part 1 (text/plain, inline)]
On 03/02/2014 05:38 PM, Bernhard Voelker wrote:
> On 03/02/2014 03:33 PM, Pádraig Brady wrote:
>> On 03/02/2014 12:33 PM, Mateusz Jończyk wrote:
>>> Hello,
>>> There should be a warning when running df --si -h because it will display results
>>> in blocks of 1024 and not 1000, as one might think (the switch --si displays blocks
>>> in a human-readable format when used by itself).
>>
>> This is confusing.
> 
> Indeed, or not ...
> 
>> I think the confusion stems from the option names themselves.
>> I.E. I'm not sure you'd want to warn as you might want to support overriding options.
>> Consider: alias df='df -h'
>>
>> Then you could very well want to `df -H` to override the power from 1024 to 1000.
> 
> ... because df really honors the last given option (as expected):

Yep that's my point. I.E. we should probably not issue a warning in this case.

>> So really the option should be --human-si not just --si.
> 
> Well, I'm 80:20 against this. Df(1) just honors the latest option
> given - no matter what the name of the option's name is.  Renaming
> an option is almost always a "suboptimal" thing for users.
> In this case, some might be already used to type "df --human" which
> would not be distinguishable from --human-si anymore.

I completely agree. --human-si would be bad for this reason.
--si-human perhaps would be better and backwards compatible,
though probably not worth it because it would introduce incompatibility
for scripts using the full --si-human and older systems supporting just --si.

> The problem is maybe that "df --help" doesn't explicitly say that -h
> is using powers of 1024 no matter what other option was given before.
> 
>   -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
>   -H, --si              likewise, but use powers of 1000 not 1024
> 
> However, the info page is quite clear about this:

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.

thanks,
Pádraig.
[df--si-docs.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 04:56:02 GMT) Full text and rfc822 format available.

Message #25 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: P <at> draigBrady.com
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Sun, 02 Mar 2014 20:55:29 -0800
Pádraig Brady wrote:
> +  -h, --human-readable  print abbreviated sizes in powers of 1024 (e.g. %s)\n\
> +  -H, --si              print abbreviated sizes in powers of 1000 (e.g. %s)\n\

Thanks for looking into improving this.  Please put commas after "e.g.". 
 Also, I suggest removing "abbreviated", and simplifying the 
translator's job by simply interpolating the human.  E.g.:

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





Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 08:01:02 GMT) Full text and rfc822 format available.

Message #28 received at 16922-done <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: Mateusz Jończyk <mat.jonczyk <at> o2.pl>,
 16922-done <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 09:36:01 GMT) Full text and rfc822 format available.

Message #31 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: Mateusz Jończyk <mat.jonczyk <at> o2.pl>,
 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 09:35:32 +0000
On 03/03/2014 08:00 AM, Bernhard Voelker wrote:
> 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:

True. I considered mentioning that, but the user doesn't really _need_
to know that. The more mathematically inclined will see it immediately,
but that's a small advantage and shouldn't be needed as we wanted these
descriptions to be meaningful in isolation anyway.

> 
>> +      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).

So SIZE here refers to the _input_ argument mentioned previously in the --help.
We might make this a bit more clear with BSIZE, but this same note is refactored
for use by df, du, ls, split, truncate. truncate(1) for example uses it to refer
to both a threshold and block size. Perhaps we should clarify like:

    The SIZE argument is an integer and optional unit (example: 10K is 10*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?

It is confusing unfortunately.
I previously summarized some of these inconsistencies here:
http://lists.gnu.org/archive/html/coreutils/2012-09/msg00179.html

Who would have thought that df would have so many inconsistencies and edge cases :/

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 09:37:02 GMT) Full text and rfc822 format available.

Message #34 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 09:36:24 +0000
On 03/03/2014 04:55 AM, Paul Eggert wrote:
> Pádraig Brady wrote:
>> +  -h, --human-readable  print abbreviated sizes in powers of 1024 (e.g. %s)\n\
>> +  -H, --si              print abbreviated sizes in powers of 1000 (e.g. %s)\n\
> 
> Thanks for looking into improving this.  Please put commas after "e.g.".  Also, I suggest removing "abbreviated", and simplifying the translator's job by simply interpolating the human.  E.g.:
> 
> -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)\n\
> -H, --si              print sizes in powers of 1000 (e.g., 1.1G)\n\

Better thanks.
I've rolled that into my local patch.

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 10:07:02 GMT) Full text and rfc822 format available.

Message #37 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: Mateusz Jończyk <mat.jonczyk <at> o2.pl>,
 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 11:06:55 +0100
On 03/03/2014 10:35 AM, Pádraig Brady wrote:
> On 03/03/2014 08:00 AM, Bernhard Voelker wrote:
>> On 03/03/2014 04:02 AM, Pádraig Brady wrote:
>>    -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:
>
> True. I considered mentioning that, but the user doesn't really _need_
> to know that. The more mathematically inclined will see it immediately,
> but that's a small advantage and shouldn't be needed as we wanted these
> descriptions to be meaningful in isolation anyway.

I agree.

>>> +      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).
>
> So SIZE here refers to the _input_ argument mentioned previously in the --help.
> We might make this a bit more clear with BSIZE, but this same note is refactored
> for use by df, du, ls, split, truncate. truncate(1) for example uses it to refer
> to both a threshold and block size. Perhaps we should clarify like:
>
>      The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
>      Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB, ... (powers of 1000).

Good idea. Thanks.

>> 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?
>
> It is confusing unfortunately.
> I previously summarized some of these inconsistencies here:
> http://lists.gnu.org/archive/html/coreutils/2012-09/msg00179.html

Thanks for the link ... it seems that it's always only me who is
confused, and coincidentally that post was also on a Monday. ;-)
Therefore, I think we can go with the stuff you have in your
local patch.

Thanks & have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 10:55:01 GMT) Full text and rfc822 format available.

Message #40 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 10:54:19 +0000
On 03/03/2014 09:36 AM, Pádraig Brady wrote:
> On 03/03/2014 04:55 AM, Paul Eggert wrote:
>> Pádraig Brady wrote:
>>> +  -h, --human-readable  print abbreviated sizes in powers of 1024 (e.g. %s)\n\
>>> +  -H, --si              print abbreviated sizes in powers of 1000 (e.g. %s)\n\
>>
>> Thanks for looking into improving this.  Please put commas after "e.g.".  Also, I suggest removing "abbreviated", and simplifying the translator's job by simply interpolating the human.  E.g.:
>>
>> -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)\n\
>> -H, --si              print sizes in powers of 1000 (e.g., 1.1G)\n\
> 
> Better thanks.
> I've rolled that into my local patch.

Actually I left the %s in the string to be replaced at runtime,
so that 1.1G or 1,1G is output as appropriate.

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 11:36:01 GMT) Full text and rfc822 format available.

Message #43 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 11:35:44 +0000
[Message part 1 (text/plain, inline)]
On 03/03/2014 10:54 AM, Pádraig Brady wrote:
> On 03/03/2014 09:36 AM, Pádraig Brady wrote:
>> On 03/03/2014 04:55 AM, Paul Eggert wrote:
>>> Pádraig Brady wrote:
>>>> +  -h, --human-readable  print abbreviated sizes in powers of 1024 (e.g. %s)\n\
>>>> +  -H, --si              print abbreviated sizes in powers of 1000 (e.g. %s)\n\
>>>
>>> Thanks for looking into improving this.  Please put commas after "e.g.".  Also, I suggest removing "abbreviated", and simplifying the translator's job by simply interpolating the human.  E.g.:
>>>
>>> -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)\n\
>>> -H, --si              print sizes in powers of 1000 (e.g., 1.1G)\n\
>>
>> Better thanks.
>> I've rolled that into my local patch.
> 
> Actually I left the %s in the string to be replaced at runtime,
> so that 1.1G or 1,1G is output as appropriate.

I suppose it's better to err on the side of less code,
and let the translator adjust, assuming LC_MESSAGES == LC_NUMERIC.
The alternative edge case is probably not worth the extra code.

I'll push the attached soon.

thanks,
Pádraig.
[df--si-docs.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 14:31:02 GMT) Full text and rfc822 format available.

Message #46 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>, 
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 15:29:47 +0100
On 03/03/2014 12:35 PM, Pádraig Brady wrote:
> I suppose it's better to err on the side of less code,
> and let the translator adjust, assuming LC_MESSAGES == LC_NUMERIC.
> The alternative edge case is probably not worth the extra code.
>
> I'll push the attached soon.

+1

Thanks!

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 15:21:01 GMT) Full text and rfc822 format available.

Message #49 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Mateusz Jończyk <mat.jonczyk <at> o2.pl>
To: Pádraig Brady <P <at> draigBrady.com>, 
 Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 16:19:59 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

W dniu 03.03.2014 04:02, Pádraig Brady pisze:
> On 03/02/2014 05:38 PM, Bernhard Voelker 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.
> 
This patch fixes only the --help output, not the man page (which should be done
separately).

Seriously, wouldn't it be better to hardcode 1023M and 1.1G(B) into the code then
calculate them every time?
> thanks, Pádraig.
> 


W dniu 03.03.2014 11:06, Bernhard Voelker pisze:
> On 03/03/2014 10:35 AM, Pádraig Brady wrote:
>> So SIZE here refers to the _input_ argument mentioned previously in the
>> --help. We might make this a bit more clear with BSIZE, but this same note is
>> refactored for use by df, du, ls, split, truncate. truncate(1) for example
>> uses it to refer to both a threshold and block size. Perhaps we should clarify
>> like:
>> 
>> The SIZE argument is an integer and optional unit (example: 10K is 10*1024). 
>> Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB, ... (powers of 1000).
> 
> Good idea. Thanks.
> 
Maybe:
"The SIZE argument consists of an integer and an optional unit."

> Thanks for the link ... it seems that it's always only me who is confused, and
> coincidentally that post was also on a Monday. ;-) Therefore, I think we can go
> with the stuff you have in your local patch.

> 
> Thanks & have a nice day, Berny


- -- 
Pozdrawiam,
Mateusz Jończyk
AEI, Informatyka, Semestr 2 Magisterskich, BDiIS

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: My public key: 0x2C64C488 on hkp://pool.sks-keyservers.net
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTFJ2dAAoJELLT9LcsZMSIukMIAKaUog2zoY/0Ytkrv5zXSk7o
f5tReuQ4HODIVTdJVDbjstKxavOTbIBAB0unEgZ+NJfdKNLNWvm0cJVwa6ipnCuI
1Quv6tfNo7szYFKsQFTsFXt5LGpH6e5r8amWwxUF3WmTeqRTHq6JNL56HVzb/CYx
3Fsm8QVO3bKQ/BC7GCK6K41war++lz+zG6cOJuKeXXxh96T1EMIGhSDpi8bcENwK
nEQZk5N3RnWY7Y7iswYyDgXpBBaFrMTtEgHjrMskl5hf3hkYGf186IokpSW+C2jI
LZeu3LsMrpCg+0sd1w8nP46Sr+D/3QHdxaDYgg41YaSBzesj5jqUEGUqnAieYWY=
=4cxU
-----END PGP SIGNATURE-----




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 16:42:02 GMT) Full text and rfc822 format available.

Message #52 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Mateusz Jończyk <mat.jonczyk <at> o2.pl>
Cc: Bernhard Voelker <mail <at> bernhard-voelker.de>, 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 16:41:10 +0000
On 03/03/2014 03:19 PM, Mateusz Jończyk wrote:
> W dniu 03.03.2014 04:02, Pádraig Brady pisze:
>> On 03/02/2014 05:38 PM, Bernhard Voelker 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.
> 
> This patch fixes only the --help output, not the man page (which should be done
> separately).

The man pages are generated from --help

> Seriously, wouldn't it be better to hardcode 1023M and 1.1G(B) into the code then
> calculate them every time?

Yes we've already switched to hardcoded values
with associated translator notes.

> W dniu 03.03.2014 11:06, Bernhard Voelker pisze:
>> On 03/03/2014 10:35 AM, Pádraig Brady wrote:
>>> So SIZE here refers to the _input_ argument mentioned previously in the
>>> --help. We might make this a bit more clear with BSIZE, but this same note is
>>> refactored for use by df, du, ls, split, truncate. truncate(1) for example
>>> uses it to refer to both a threshold and block size. Perhaps we should clarify
>>> like:
>>>
>>> The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
>>> Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB, ... (powers of 1000).
> 
>> Good idea. Thanks.
> 
> Maybe:
> "The SIZE argument consists of an integer and an optional unit."

Sometimes these are worded slightly awkwardly to be more
concise and fit available space.

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#16922; Package coreutils. (Mon, 03 Mar 2014 17:28:02 GMT) Full text and rfc822 format available.

Message #55 received at 16922 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Mateusz Jończyk <mat.jonczyk <at> o2.pl>,
 Pádraig Brady <P <at> draigBrady.com>,
 Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 16922 <at> debbugs.gnu.org
Subject: Re: bug#16922: df --si -h should emit a warning
Date: Mon, 03 Mar 2014 10:27:21 -0700
[Message part 1 (text/plain, inline)]
On 03/03/2014 08:19 AM, Mateusz Jończyk wrote:
> W dniu 03.03.2014 04:02, Pádraig Brady pisze:
>> On 03/02/2014 05:38 PM, Bernhard Voelker 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.
> 
> This patch fixes only the --help output, not the man page (which should be done
> separately).

The man page is auto-generated from the --help output.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Apr 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.