--- Begin Message ---
Subject: |
df --si -h should emit a warning |
Date: |
Sun, 02 Mar 2014 13:33:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
-----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-----
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#16922: df --si -h should emit a warning |
Date: |
Mon, 03 Mar 2014 03:02:38 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
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
Description: Text Data
--- End Message ---