Subject: Re: bug#20366: Strange behaviour of df (GNU coreutils) 8.23

From: Pádraig Brady <[email-masked]>
Date: Sun, 19 Apr 2015 11:53:56 +0100

On 18/04/15 11:44, Benjamin Beier wrote:
> Hello,
> 
> I am running multiple Gentoo/Funtoo servers and yesterday I noticed the 
> output of 'df -a' on the Funtoo systems does not show any information 
> about the root partition, although this works fine on all my Gentoo 
> systems. I compared the installed versions and after a little 
> investigation with upgrades and downgrades on both systems i found out, 
> that the problem is caused by coreutils version 8.23 (Funtoo default), 
> while coreutils version 8.21 (Gentoo default) works fine.
> 
> df -a on 8.21:
> rootfs                   3997376 1947348   1823932  52% /
> /dev/root                3997376 1947348   1823932  52% /
> (...)
> 
> df -a on 8.23:
> rootfs                         -       -         -    - /
> /dev/root                      -       -         -    - /
> (...)

  /var/lib/ntp                   -       -         -    - /chroot/ntpd/var/lib/ntp
  /var/log/ntp             3997376 1947140   1824140  52% /chroot/ntpd/var/log/ntp

> I also straced df with both versions and interestingly both versions 
> seem to collect valid usage information about the root partition. While 
> 8.21 is showing this information in the output, 8.23 just decides to 
> print dashes for some reason?
> 
> I attached the strace and full output of both versions.

With the current assumptions in df, it's awkward for the 'Filesystem',
i.e. the first column, to keep changing, when in fact the corresponding
device ID returned by stat() stays the same.

Does /etc/mtab symlink to /proc/mounts on your system?
I suspect it doesn't and thus bind mounts are represented as above.
Does the issue go away if you temporarily replace /etc/mtab
with a symlink to /proc/mounts?

In the next release of df (after coreutils next syncs with gnulib),
/proc/self/mountinfo will be queried instead, and thus probably
avoiding this issue?

thanks,
Pádraig.