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: Noel McLoughlin
Subject: Re: #1303795 RFE: df output is non intuitive - multiple files residing in current directory
Date: Thu, 4 Feb 2016 16:17:22 +0000

Hi Berny,

Despite raising the RFE, I am also wary of nit-picking.  The unix
philosophy and *nix variants are flexible in how "FILE ..." is expressed
and utilities may have their own validation rules for "FILE ...".
Interestingly, the synopsis of df(1) and sort(1) is identical in man pages
"FILE ..."  but validation rules are not consistent when globbing ..

# pwd
/usr/share
# sort * | wc -l
sort: read failed: abrt: Is a directory
0
# df -l * | wc -l
233


regards
Noel

On Thu, Feb 4, 2016 at 8:31 AM, Bernhard Voelker <address@hidden>
wrote:

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