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.

Full log


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)]

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

Previous Next


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