coreutils
[Top][All Lists]
Advanced

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

Re: #1303795 RFE: df output is non intuitive - multiple files residing i


From: Bernhard Voelker
Subject: Re: #1303795 RFE: df output is non intuitive - multiple files residing in current directory
Date: Thu, 4 Feb 2016 09:31:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 02/03/2016 10:39 AM, Noel McLoughlin wrote:
> I raised an enhancement on df(1) in coreutils.
> 
> I think df should provide an option to remove duplicates from output by
> supporting --unique option like sort(1).  This df output is non intuitive
> when using globbing wildcard ('*') and output from '--total' becomes
> nonsensical.
> 
> Could you look at the RFE and suggest "expected results" as upstream
> community.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1303795

I'm not too enthusiastic for such an option.  This is the first time
I've seen someone doing "df *".  Although it doesn't seem to be explicitly
specified by POSIX, I'd assume a consistent behavior like many other tools
which do their job for each command line argument regardless whether it
may make sense (stat, du) or maybe not (df, dirname).

Furthermore, since the introduction of the output field 'file', it really
makes sense to not unify the output:


  $ df -h --out=source,target,file df du mv
  Filesystem     Mounted on      File
  /dev/sda5      /media/big_data df
  /dev/sda5      /media/big_data du
  /dev/sda5      /media/big_data mv

A --unique option would clash with this output format.

Finally, I'm not sure if everyone is aware that also regular files can
be a mount point (admittedly, the output of 'findmnt' is a little more
useful in this case):

  $ touch a b c

  $ mount --bind /proc/cpuinfo b
  $ mount --bind /sys/kernel/notes c

  $ df -h a b c
  Filesystem      Size  Used Avail Use% Mounted on
  /dev/sda2        20G   14G  5.2G  73% /
  proc               0     0     0    - /root/tmp/b
  sysfs              0     0     0    - /root/tmp/c

Still, when 2 lines are really identical (because they are on the
same file system and not mounted over), it may be valid to squeeze
the output, but I don't think this is following the principle of
least suprise: someone might be confused why some lines are missing
... or even relying on that in a script.  Anyway, one may simply
do that with "... | sort -u" if needed.

Have a nice day,
Berny



reply via email to

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