bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Pádraig Brady
Subject: 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.

Attachment: df--si-docs.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]