bug-coreutils
[Top][All Lists]
Advanced

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

bug#16539: More details on df command output for you


From: Bernhard Voelker
Subject: bug#16539: More details on df command output for you
Date: Wed, 14 May 2014 00:20:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 05/12/2014 05:10 PM, Pádraig Brady wrote:
> I've attached 4 patches for df to:
> 
>     df: also deduplicate virtual file systems
>     df: fix handling of symlinks in mount list
>     df: ignore non file system entries in /proc/mounts
>     maint: avoid clang -Wtautological-constant-out-of-range-compare warning

They are look good to me - great work, thanks!
AFAIR, the last one was also warned about by Coverity (but
I can't check now as their website is down for maintenance).

> Not included is your "overmount change" or the "d)" adjustment above,
> as I was unsure how you wanted to handle exactly.

To recap, this was the problem:

  $ mount /dev/sda5 /tmp/mnt
  $ mount -o loop tmp.img /tmp/mnt

df - even including your 4 patches - shows wrong results:

  $ src/df | grep mnt
  /dev/sda5          59365      1308     53471   3% /tmp/mnt

  $ src/df -a | grep mnt
  /dev/sda5          59365      1308     53471   3% /tmp/mnt
  /dev/loop0         59365      1308     53471   3% /tmp/mnt

The idea was to trust the order of /proc/mounts

  $ tail -n2 /proc/mounts
  /dev/sda5 /tmp/mnt ext2 rw,relatime 0 0
  /dev/loop0 /tmp/mnt ext3 rw,relatime,data=ordered 0 0

i.e., loop through the mount list leaving only the
last unique (maybe canonicalized) mount point.

Another special case is when a mount point is not reachable
at all anymore:

  /dev/sda5 /tmp/mnt/some/subdir ext2 rw,relatime 0 0
  /dev/loop0 /tmp/mnt ext3 rw,relatime,data=ordered 0 0

I recommend discarding eclipsed mounts in normal output,
and output "-" values with -a.

Thanks & have a nice day,
Berny





reply via email to

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