On 05/13/2014 11:20 PM, Bernhard Voelker wrote: > 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. The attached (on top of df-fix-last-device.diff) should put "-" placeholder values in the needed cases. That should be it for df fixes for coreutils-8.23. cheers, Pádraig.