GNU bug report logs - #16539
df command, possible bug?

Previous Next

Package: coreutils;

Reported by: crubel <at> compro.net

Date: Fri, 24 Jan 2014 20:39:01 UTC

Severity: normal

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


Message #50 received at 16539 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 16539 <at> debbugs.gnu.org
Subject: Re: bug#16539: More details on df command output for you
Date: Wed, 14 May 2014 00:20:08 +0200
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




This bug report was last modified 10 years and 333 days ago.

Previous Next


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