bug#17833: coreutils 8.22 df
On Thu, Jul 10, 2014 at 4:28 PM, Pádraig Brady wrote: > The attached should handle this by giving precedence > to displaying real device nodes. Thanks. That looks fine. I'd add an "s" to that NEWS entry: s/give/gives/ + df now give precedence to displaying real device nodes in the presence of
bug#17833: coreutils 8.22 df
* Pádraig Brady : | > $ ls -l /etc/mtab | > -rw-r--r-- 1 root root 391 Jun 22 10:18 /etc/mtab | > | > $ cat /etc/mtab | > /dev/md0 / ext3 rw,errors=remount-ro 0 0 | > proc /proc proc rw,relatime 0 0 | > sysfs /sys sysfs rw,relatime 0 0 | > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 | > devpts /dev/pts devpts rw,relatime,mode=620 0 0 | > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 | > /var/archive/home /home none rw,bind 0 0 | > /var/archive/spool /var/spool none rw,bind 0 0 | > /var/archive/www /var/lib/www none rw,bind 0 0 | It's an older setup. What distro is this? Nope. | You could setup like newer systems by doing: | cp /etc/mtab{,.safe} | ln -nsf /proc/mounts /etc/mtab manual says: 'but some information is lost that way, and in particular using the "user" option will fail.'
bug#17833: coreutils 8.22 df
On 07/11/2014 09:39 AM, Gabor Z. Papp wrote: > * Pádraig Brady : > > | > Presumably the version of mount is also quite old on such a system, > | > and now we would add complexity to current df to work around the > | > problems of such old mount? > > Lets clear this. > > $ uname -a > Linux host 3.4.94 #1 SMP Sun Jun 22 09:35:43 CEST 2014 i686 GNU/Linux > > $ /lib/libc.so.6 | grep release > GNU C Library (GNU libc) stable release version 2.19, by Roland McGrath et al. > > $ mount --version > mount from util-linux 2.24.1 (libmount 2.24.0: debug, assert) > > So is this an old system? I'm confused whats the problem with the system. > > $ ls -l /etc/mtab > -rw-r--r-- 1 root root 391 Jun 22 10:18 /etc/mtab > > $ cat /etc/mtab > /dev/md0 / ext3 rw,errors=remount-ro 0 0 > proc /proc proc rw,relatime 0 0 > sysfs /sys sysfs rw,relatime 0 0 > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 > devpts /dev/pts devpts rw,relatime,mode=620 0 0 > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 > /var/archive/home /home none rw,bind 0 0 > /var/archive/spool /var/spool none rw,bind 0 0 > /var/archive/www /var/lib/www none rw,bind 0 0 It's an older setup. What distro is this? You could setup like newer systems by doing: cp /etc/mtab{,.safe} ln -nsf /proc/mounts /etc/mtab
bug#17833: coreutils 8.22 df
* Pádraig Brady : | > Presumably the version of mount is also quite old on such a system, | > and now we would add complexity to current df to work around the | > problems of such old mount? Lets clear this. $ uname -a Linux host 3.4.94 #1 SMP Sun Jun 22 09:35:43 CEST 2014 i686 GNU/Linux $ /lib/libc.so.6 | grep release GNU C Library (GNU libc) stable release version 2.19, by Roland McGrath et al. $ mount --version mount from util-linux 2.24.1 (libmount 2.24.0: debug, assert) So is this an old system? I'm confused whats the problem with the system. $ ls -l /etc/mtab -rw-r--r-- 1 root root 391 Jun 22 10:18 /etc/mtab $ cat /etc/mtab /dev/md0 / ext3 rw,errors=remount-ro 0 0 proc /proc proc rw,relatime 0 0 sysfs /sys sysfs rw,relatime 0 0 tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 devpts /dev/pts devpts rw,relatime,mode=620 0 0 /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 /var/archive/home /home none rw,bind 0 0 /var/archive/spool /var/spool none rw,bind 0 0 /var/archive/www /var/lib/www none rw,bind 0 0
bug#17833: coreutils 8.22 df
On 07/11/2014 01:20 AM, Bernhard Voelker wrote: > On 07/11/2014 01:28 AM, Pádraig Brady wrote: >> Subject: [PATCH] df: give precedence to real device nodes >> >> This is significant when /etc/mtab is a real file >> rather than a symlink to /proc/mounts, [...] > > In the days we almost start thinking about to switch to > /proc/self/mountinfo for df like mount/util-linux has done long > time ago, I'm not sure if we should support such old (or broken?) > systems. > Presumably the version of mount is also quite old on such a system, > and now we would add complexity to current df to work around the > problems of such old mount? > After all, it's just one stat() more, so I'm 50:50. Fair point. Also there is a bigger issue with this. Consider a local mount point, which is then eclipsed with an NFS mount for example. With this patch we'd ignore the NFS mount, which is incorrect. Given we already display the correct storage sizes, and this is only on older systems not using /proc/mounts, I'm leaning towards not handling this particular edge case. thanks, Pádraig.
bug#17833: coreutils 8.22 df
On 07/11/2014 01:28 AM, Pádraig Brady wrote: > Subject: [PATCH] df: give precedence to real device nodes > > This is significant when /etc/mtab is a real file > rather than a symlink to /proc/mounts, [...] In the days we almost start thinking about to switch to /proc/self/mountinfo for df like mount/util-linux has done long time ago, I'm not sure if we should support such old (or broken?) systems. Presumably the version of mount is also quite old on such a system, and now we would add complexity to current df to work around the problems of such old mount? After all, it's just one stat() more, so I'm 50:50. > diff --git a/src/df.c b/src/df.c > index 063cabf..46aeef9 100644 > --- a/src/df.c > +++ b/src/df.c > @@ -48,6 +48,7 @@ > static struct devlist > { >dev_t dev_num; > + bool real_dev; >struct mount_entry *me; >struct devlist *next; > } *device_list; > @@ -618,35 +619,46 @@ filter_mount_list (bool devices_only) >/* Sort all 'wanted' entries into the list device_list. */ >for (me = mount_list; me;) > { > - struct stat buf; > + struct stat mnt_buf; >struct devlist *devlist; >struct mount_entry *discard_me = NULL; > + bool real_dev = false; > >/* TODO: On Linux we might avoid this stat() and another in get_dev() > by using the device IDs available from /proc/self/mountinfo. > read_file_system_list() could populate me_dev from those > for efficiency and accuracy. */ > - if (-1 == stat (me->me_mountdir, &buf)) > + if (-1 == stat (me->me_mountdir, &mnt_buf)) > { >/* Stat failed - add ME to be able to complain about it later. */ > - buf.st_dev = me->me_dev; > + mnt_buf.st_dev = me->me_dev; > } >else > { > + /* when /etc/mtab is not linked to /proc/mounts, > + then in the presence of bind mounts, the source will > + be the bind mounted directory, rather than the base device. > + In this case we want to give precedence to the base device. */ > + struct stat sb; > + real_dev = (! me->me_dummy > + && stat (me->me_devname, &sb) == 0 > + && (S_ISBLK (sb.st_mode) || S_ISCHR (sb.st_mode))); > + >/* If we've already seen this device... */ >for (devlist = device_list; devlist; devlist = devlist->next) > -if (devlist->dev_num == buf.st_dev) > +if (devlist->dev_num == mnt_buf.st_dev) >break; > >if (devlist) > { >/* ...let the shorter mountdir win. */ > - if ((strchr (me->me_devname, '/') > - && ! strchr (devlist->me->me_devname, '/')) > - || (strlen (devlist->me->me_mountdir) > - > strlen (me->me_mountdir)) > - /* or one overmounted on a different device. */ > - || ! STREQ (devlist->me->me_devname, me->me_devname)) > + if (real_dev >= devlist->real_dev > + && ((strchr (me->me_devname, '/') > + && ! strchr (devlist->me->me_devname, '/')) > + || (strlen (devlist->me->me_mountdir) > + > strlen (me->me_mountdir)) > + /* or one overmounted on a different device. */ > + || ! STREQ (devlist->me->me_devname, me->me_devname))) Wow, I never tried to use >= operator on a bool type, but it's - although IMO not very readable - obviously permitted and working. > { >/* Discard mount entry for existing device. */ >discard_me = devlist->me; > @@ -672,7 +684,8 @@ filter_mount_list (bool devices_only) >/* Add the device number to the global list devlist. */ >devlist = xmalloc (sizeof *devlist); >devlist->me = me; > - devlist->dev_num = buf.st_dev; > + devlist->dev_num = mnt_buf.st_dev; > + devlist->real_dev = real_dev; >devlist->next = device_list; >device_list = devlist; > > -- 1.7.7.6 With all the recent patches it seems like the upcoming refactoring of df.c could get some hard work ... or fun (depending on how one may want to put it). ;-) Thanks & have a nice day, Berny
bug#17833: coreutils 8.22 df
On 07/08/2014 06:28 PM, Pádraig Brady wrote: > On 06/25/2014 01:24 PM, Gabor Z. Papp wrote: >> * Pádraig Brady : >> >> | > $ cat /etc/mtab >> | > /dev/md0 / ext3 rw,errors=remount-ro 0 0 >> | > proc /proc proc rw,relatime 0 0 >> | > sysfs /sys sysfs rw,relatime 0 0 >> | > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 >> | > devpts /dev/pts devpts rw,relatime,mode=620 0 0 >> | > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 >> | > /var/archive/home /home none rw,bind 0 0 >> | > /var/archive/spool /var/spool none rw,bind 0 0 >> | > /var/archive/www /var/lib/www none rw,bind 0 0 >> >> | Is this mtab really a link to /proc/mounts? >> >> No, its a standalone file. >> >> | That's the normal case on modern Linux distros. >> >> Its not a modern linux. :-) >> >> | > $ df-8.22 -h >> | > Filesystem Size Used Avail Use% Mounted on >> | > /dev/md0 21G 8.8G 11G 46% / >> | > tmpfs 4.0K 0 4.0K 0% /dev >> | > >> | > And where is /dev/md1 ? >> >> | Not sure what's going on here. >> | Since you've compiled various versions, >> | could you replace src/df.c in your 8.22 build dir with: >> | >> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/df.c;hb=HEAD >> | There have been many df changes since 8.22, so it would >> | be good to check with the latest. >> >> $ /tmp/df-git -h >> Filesystem Size Used Avail Use% Mounted on >> /dev/md0 21G 9.0G 11G 47% / >> tmpfs 4.0K 0 4.0K 0% /dev >> >> Same problem, /dev/md1 missing. > > The missing entry is due to the bind mounts being classified as "dummy" > devices. > There is code in gnulib to explicitly avoid that for bind mounts, > however that was negated with this change: > http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=62bb7a8b > Now that change is correct in isolation, but when combined > with the incomplete original change, it triggered the issue. > The attached patch should fix this up. > >> >> | > running df from coreutils 8.21 shows different result: >> | > >> | > $ df-8.21 -h >> | > Filesystem Size Used Avail Use% Mounted on >> | > /dev/md021G 8.8G 11G 46% / >> | > tmpfs 4.0K 0 4.0K 0% /dev >> | > /var/archive/home 273G 244G 29G 90% /home >> | > >> | > Still weird. >> >> | As part of the device de-duplication logic we used in 8.21 >> | we're favoring '/home' since it's shorter than '/var/archive' >> | and thus we're using the '/var/archive/home' "device". >> >> | > Trying with 8.20: >> | > >> | > $ df-8.20 -h >> | > Filesystem Size Used Avail Use% Mounted on >> | > /dev/md0 21G 8.8G 11G 46% / >> | > tmpfs 4.0K 0 4.0K 0% /dev >> | > /dev/md1273G 244G 29G 90% /var/archive >> >> | I agree that this is the best output for your case. >> >> Right. >> >> | I suppose we could stat the sources in the de-duplication logic >> | to favor real devices. I.E. stat '/var/archive/home' and '/dev/md1' >> | in your case to favor the latter. > > That's something we could still do in addition in coreutils. The attached should handle this by giving precedence to displaying real device nodes. thanks, Pádraig. >From 840e7afb6d7d499d52aaac0f9d34cb90208b2183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 10 Jul 2014 23:59:35 +0100 Subject: [PATCH] df: give precedence to real device nodes This is significant when /etc/mtab is a real file rather than a symlink to /proc/mounts, in which case the bind mounted dir will be listed as the source "device" rather than the real base device. Therefore we stat the device node, which should be local and a relatively cheap operation, and give precedence to real device nodes. For example given this setup: truncate -s10M bind.img mkfs -F bind.img mount bind.img /var/archive/ mkdir -p /var/archive/home mkdir -p /t/home mount --bind /var/archive/home/ /t/home/ on an older system without /proc/mounts we would have displayed: FilesystemMounted on /var/archive/home//t/home but we now display: FilesystemMounted on /dev/loop0/var/archive Note on a newer system using /proc/mounts we display: FilesystemMounted on /dev/loop0/t/home * src/df.c (filter_mount_list): stat() the device node for each mount entry and use that to give precedence to real device nodes. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/17833 --- NEWS |5 + src/df.c | 35 --- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 4e90b79..e942fe8 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,11 @@ GNU coreutils NEWS-*- outline -*- than error messages or values for the wrong file system. [These bugs were present in "the beginning".] + df now give precedence to displaying real device nodes in the presence of + bind mounts, on systems where the base device
bug#17833: coreutils 8.22 df
On 06/25/2014 01:24 PM, Gabor Z. Papp wrote: > * Pádraig Brady : > > | > $ cat /etc/mtab > | > /dev/md0 / ext3 rw,errors=remount-ro 0 0 > | > proc /proc proc rw,relatime 0 0 > | > sysfs /sys sysfs rw,relatime 0 0 > | > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 > | > devpts /dev/pts devpts rw,relatime,mode=620 0 0 > | > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 > | > /var/archive/home /home none rw,bind 0 0 > | > /var/archive/spool /var/spool none rw,bind 0 0 > | > /var/archive/www /var/lib/www none rw,bind 0 0 > > | Is this mtab really a link to /proc/mounts? > > No, its a standalone file. > > | That's the normal case on modern Linux distros. > > Its not a modern linux. :-) > > | > $ df-8.22 -h > | > Filesystem Size Used Avail Use% Mounted on > | > /dev/md0 21G 8.8G 11G 46% / > | > tmpfs 4.0K 0 4.0K 0% /dev > | > > | > And where is /dev/md1 ? > > | Not sure what's going on here. > | Since you've compiled various versions, > | could you replace src/df.c in your 8.22 build dir with: > | > http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/df.c;hb=HEAD > | There have been many df changes since 8.22, so it would > | be good to check with the latest. > > $ /tmp/df-git -h > Filesystem Size Used Avail Use% Mounted on > /dev/md0 21G 9.0G 11G 47% / > tmpfs 4.0K 0 4.0K 0% /dev > > Same problem, /dev/md1 missing. The missing entry is due to the bind mounts being classified as "dummy" devices. There is code in gnulib to explicitly avoid that for bind mounts, however that was negated with this change: http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=62bb7a8b Now that change is correct in isolation, but when combined with the incomplete original change, it triggered the issue. The attached patch should fix this up. > > | > running df from coreutils 8.21 shows different result: > | > > | > $ df-8.21 -h > | > Filesystem Size Used Avail Use% Mounted on > | > /dev/md021G 8.8G 11G 46% / > | > tmpfs 4.0K 0 4.0K 0% /dev > | > /var/archive/home 273G 244G 29G 90% /home > | > > | > Still weird. > > | As part of the device de-duplication logic we used in 8.21 > | we're favoring '/home' since it's shorter than '/var/archive' > | and thus we're using the '/var/archive/home' "device". > > | > Trying with 8.20: > | > > | > $ df-8.20 -h > | > Filesystem Size Used Avail Use% Mounted on > | > /dev/md0 21G 8.8G 11G 46% / > | > tmpfs 4.0K 0 4.0K 0% /dev > | > /dev/md1273G 244G 29G 90% /var/archive > > | I agree that this is the best output for your case. > > Right. > > | I suppose we could stat the sources in the de-duplication logic > | to favor real devices. I.E. stat '/var/archive/home' and '/dev/md1' > | in your case to favor the latter. That's something we could still do in addition in coreutils. thanks, Pádraig. >From cbf9cb454f76c64088989bd246f3e5f73256329c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 8 Jul 2014 18:17:03 +0100 Subject: [PATCH] mountlist: don't treat bind mounts as dummy mounts This was originally implemented with commit 613bcb62, however that change failed to check for hasmntopt(). Then a subsequent commit 62bb7a8b caused hasmntopt() to be replaced on most platforms. * m4/ls-mntd-fs.m4: Check for hasmntopt() in the MOUNTED_GETMNTENT1 case also. --- ChangeLog|6 ++ m4/ls-mntd-fs.m4 |1 + 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81e800f..231558f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-07-08 Pádraig Brady + + mountlist: don't treat bind mounts as dummy mounts + * m4/ls-mntd-fs.m4: Check for hasmntopt() in the MOUNTED_GETMNTENT1 + case also. + 2014-07-07 Eli Zaretskii Paul Eggert diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 index a5e169b..563ed71 100644 --- a/m4/ls-mntd-fs.m4 +++ b/m4/ls-mntd-fs.m4 @@ -151,6 +151,7 @@ if test $ac_cv_func_getmntent = yes; then [Define if there is a function named getmntent for reading the list of mounted file systems, and that function takes a single argument. (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) + AC_CHECK_FUNCS([hasmntopt]) fi fi -- 1.7.7.6
bug#17833: coreutils 8.22 df
Apologies for resend. GNU mailers were having issues yesterday... On 06/25/2014 01:24 PM, Gabor Z. Papp wrote: > * Pádraig Brady : > > | > $ cat /etc/mtab > | > /dev/md0 / ext3 rw,errors=remount-ro 0 0 > | > proc /proc proc rw,relatime 0 0 > | > sysfs /sys sysfs rw,relatime 0 0 > | > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 > | > devpts /dev/pts devpts rw,relatime,mode=620 0 0 > | > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 > | > /var/archive/home /home none rw,bind 0 0 > | > /var/archive/spool /var/spool none rw,bind 0 0 > | > /var/archive/www /var/lib/www none rw,bind 0 0 > > | Is this mtab really a link to /proc/mounts? > > No, its a standalone file. > > | That's the normal case on modern Linux distros. > > Its not a modern linux. :-) > > | > $ df-8.22 -h > | > Filesystem Size Used Avail Use% Mounted on > | > /dev/md0 21G 8.8G 11G 46% / > | > tmpfs 4.0K 0 4.0K 0% /dev > | > > | > And where is /dev/md1 ? > > | Not sure what's going on here. > | Since you've compiled various versions, > | could you replace src/df.c in your 8.22 build dir with: > | > http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/df.c;hb=HEAD > | There have been many df changes since 8.22, so it would > | be good to check with the latest. > > $ /tmp/df-git -h > Filesystem Size Used Avail Use% Mounted on > /dev/md0 21G 9.0G 11G 47% / > tmpfs 4.0K 0 4.0K 0% /dev > > Same problem, /dev/md1 missing. The missing entry is due to the bind mounts being classified as "dummy" devices. There is code in gnulib to explicitly avoid that for bind mounts, however that was negated with this change: http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=62bb7a8b Now that change is correct in isolation, but when combined with the incomplete original change, it triggered the issue. The attached patch should fix this up. > > | > running df from coreutils 8.21 shows different result: > | > > | > $ df-8.21 -h > | > Filesystem Size Used Avail Use% Mounted on > | > /dev/md021G 8.8G 11G 46% / > | > tmpfs 4.0K 0 4.0K 0% /dev > | > /var/archive/home 273G 244G 29G 90% /home > | > > | > Still weird. > > | As part of the device de-duplication logic we used in 8.21 > | we're favoring '/home' since it's shorter than '/var/archive' > | and thus we're using the '/var/archive/home' "device". > > | > Trying with 8.20: > | > > | > $ df-8.20 -h > | > Filesystem Size Used Avail Use% Mounted on > | > /dev/md0 21G 8.8G 11G 46% / > | > tmpfs 4.0K 0 4.0K 0% /dev > | > /dev/md1273G 244G 29G 90% /var/archive > > | I agree that this is the best output for your case. > > Right. > > | I suppose we could stat the sources in the de-duplication logic > | to favor real devices. I.E. stat '/var/archive/home' and '/dev/md1' > | in your case to favor the latter. That's something we could still do in addition in coreutils. thanks, Pádraig. >From cbf9cb454f76c64088989bd246f3e5f73256329c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 8 Jul 2014 18:17:03 +0100 Subject: [PATCH] mountlist: don't treat bind mounts as dummy mounts This was originally implemented with commit 613bcb62, however that change failed to check for hasmntopt(). Then a subsequent commit 62bb7a8b caused hasmntopt() to be replaced on most platforms. * m4/ls-mntd-fs.m4: Check for hasmntopt() in the MOUNTED_GETMNTENT1 case also. --- ChangeLog|6 ++ m4/ls-mntd-fs.m4 |1 + 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81e800f..231558f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-07-08 Pádraig Brady + + mountlist: don't treat bind mounts as dummy mounts + * m4/ls-mntd-fs.m4: Check for hasmntopt() in the MOUNTED_GETMNTENT1 + case also. + 2014-07-07 Eli Zaretskii Paul Eggert diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 index a5e169b..563ed71 100644 --- a/m4/ls-mntd-fs.m4 +++ b/m4/ls-mntd-fs.m4 @@ -151,6 +151,7 @@ if test $ac_cv_func_getmntent = yes; then [Define if there is a function named getmntent for reading the list of mounted file systems, and that function takes a single argument. (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) + AC_CHECK_FUNCS([hasmntopt]) fi fi -- 1.7.7.6
bug#16189: bug#17833: coreutils 8.22 df
On 07/09/2014 10:18 AM, Pádraig Brady wrote: > Apologies for resend. GNU mailers were having issues yesterday... > > On 06/25/2014 01:24 PM, Gabor Z. Papp wrote: >> * Pádraig Brady : >> >> | > $ cat /etc/mtab >> | > /dev/md0 / ext3 rw,errors=remount-ro 0 0 >> | > proc /proc proc rw,relatime 0 0 >> | > sysfs /sys sysfs rw,relatime 0 0 >> | > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 >> | > devpts /dev/pts devpts rw,relatime,mode=620 0 0 >> | > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 >> | > /var/archive/home /home none rw,bind 0 0 >> | > /var/archive/spool /var/spool none rw,bind 0 0 >> | > /var/archive/www /var/lib/www none rw,bind 0 0 >> >> | Is this mtab really a link to /proc/mounts? >> >> No, its a standalone file. >> >> | That's the normal case on modern Linux distros. >> >> Its not a modern linux. :-) >> >> | > $ df-8.22 -h >> | > Filesystem Size Used Avail Use% Mounted on >> | > /dev/md0 21G 8.8G 11G 46% / >> | > tmpfs 4.0K 0 4.0K 0% /dev >> | > >> | > And where is /dev/md1 ? >> >> | Not sure what's going on here. >> | Since you've compiled various versions, >> | could you replace src/df.c in your 8.22 build dir with: >> | >> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/df.c;hb=HEAD >> | There have been many df changes since 8.22, so it would >> | be good to check with the latest. >> >> $ /tmp/df-git -h >> Filesystem Size Used Avail Use% Mounted on >> /dev/md0 21G 9.0G 11G 47% / >> tmpfs 4.0K 0 4.0K 0% /dev >> >> Same problem, /dev/md1 missing. > > The missing entry is due to the bind mounts being classified as "dummy" > devices. > There is code in gnulib to explicitly avoid that for bind mounts, > however that was negated with this change: > http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=62bb7a8b > Now that change is correct in isolation, but when combined > with the incomplete original change, it triggered the issue. > The attached patch should fix this up. Actually this was the cause of another bug wrt bind mounts in du. Andrew had identified the issue independently, so I'm applying this in this name now and marking http://bugs.gnu.org/16189 as done thanks, Pádraig.
bug#17833: coreutils 8.22 df
* Pádraig Brady : | > $ cat /etc/mtab | > /dev/md0 / ext3 rw,errors=remount-ro 0 0 | > proc /proc proc rw,relatime 0 0 | > sysfs /sys sysfs rw,relatime 0 0 | > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 | > devpts /dev/pts devpts rw,relatime,mode=620 0 0 | > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 | > /var/archive/home /home none rw,bind 0 0 | > /var/archive/spool /var/spool none rw,bind 0 0 | > /var/archive/www /var/lib/www none rw,bind 0 0 | Is this mtab really a link to /proc/mounts? No, its a standalone file. | That's the normal case on modern Linux distros. Its not a modern linux. :-) | > $ df-8.22 -h | > Filesystem Size Used Avail Use% Mounted on | > /dev/md0 21G 8.8G 11G 46% / | > tmpfs 4.0K 0 4.0K 0% /dev | > | > And where is /dev/md1 ? | Not sure what's going on here. | Since you've compiled various versions, | could you replace src/df.c in your 8.22 build dir with: | http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/df.c;hb=HEAD | There have been many df changes since 8.22, so it would | be good to check with the latest. $ /tmp/df-git -h Filesystem Size Used Avail Use% Mounted on /dev/md0 21G 9.0G 11G 47% / tmpfs 4.0K 0 4.0K 0% /dev Same problem, /dev/md1 missing. | > running df from coreutils 8.21 shows different result: | > | > $ df-8.21 -h | > Filesystem Size Used Avail Use% Mounted on | > /dev/md021G 8.8G 11G 46% / | > tmpfs 4.0K 0 4.0K 0% /dev | > /var/archive/home 273G 244G 29G 90% /home | > | > Still weird. | As part of the device de-duplication logic we used in 8.21 | we're favoring '/home' since it's shorter than '/var/archive' | and thus we're using the '/var/archive/home' "device". | > Trying with 8.20: | > | > $ df-8.20 -h | > Filesystem Size Used Avail Use% Mounted on | > /dev/md0 21G 8.8G 11G 46% / | > tmpfs 4.0K 0 4.0K 0% /dev | > /dev/md1273G 244G 29G 90% /var/archive | I agree that this is the best output for your case. Right. | I suppose we could stat the sources in the de-duplication logic | to favor real devices. I.E. stat '/var/archive/home' and '/dev/md1' | in your case to favor the latter. $ /tmp/df-git --version df (GNU coreutils) 8.22.127-d71c1
bug#17833: coreutils 8.22 df
On 06/22/2014 09:41 AM, Gabor Z. Papp wrote: > lo lo, > > seems like I discovered a problem in 8.22's df util: > > $ cat /etc/fstab > /dev/md0 / ext3 defaults,errors=remount-ro 0 1 > /dev/sda2 swap swap defaults 0 0 > /dev/sdb2 swap swap defaults 0 0 > /dev/md1 /var/archive ext3 defaults,errors=remount-ro 0 1 > /dev/sr0 /mnt/cdrom iso9660 defaults,noauto 0 0 > > proc /proc proc defaults 0 0 > none /proc/bus/usb usbfs defaults 0 0 > > $ cat /etc/mtab > /dev/md0 / ext3 rw,errors=remount-ro 0 0 > proc /proc proc rw,relatime 0 0 > sysfs /sys sysfs rw,relatime 0 0 > tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 > devpts /dev/pts devpts rw,relatime,mode=620 0 0 > /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 > /var/archive/home /home none rw,bind 0 0 > /var/archive/spool /var/spool none rw,bind 0 0 > /var/archive/www /var/lib/www none rw,bind 0 0 Is this mtab really a link to /proc/mounts? That's the normal case on modern Linux distros. > $ df-8.22 -h > Filesystem Size Used Avail Use% Mounted on > /dev/md0 21G 8.8G 11G 46% / > tmpfs 4.0K 0 4.0K 0% /dev > > And where is /dev/md1 ? Not sure what's going on here. Since you've compiled various versions, could you replace src/df.c in your 8.22 build dir with: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/df.c;hb=HEAD There have been many df changes since 8.22, so it would be good to check with the latest. > running df from coreutils 8.21 shows different result: > > $ df-8.21 -h > Filesystem Size Used Avail Use% Mounted on > /dev/md021G 8.8G 11G 46% / > tmpfs 4.0K 0 4.0K 0% /dev > /var/archive/home 273G 244G 29G 90% /home > > Still weird. As part of the device de-duplication logic we used in 8.21 we're favoring '/home' since it's shorter than '/var/archive' and thus we're using the '/var/archive/home' "device". > Trying with 8.20: > > $ df-8.20 -h > Filesystem Size Used Avail Use% Mounted on > /dev/md0 21G 8.8G 11G 46% / > tmpfs 4.0K 0 4.0K 0% /dev > /dev/md1273G 244G 29G 90% /var/archive I agree that this is the best output for your case. I suppose we could stat the sources in the de-duplication logic to favor real devices. I.E. stat '/var/archive/home' and '/dev/md1' in your case to favor the latter. thanks, Pádraig.
bug#17833: coreutils 8.22 df
lo lo, seems like I discovered a problem in 8.22's df util: $ cat /etc/fstab /dev/md0 / ext3 defaults,errors=remount-ro 0 1 /dev/sda2 swap swap defaults 0 0 /dev/sdb2 swap swap defaults 0 0 /dev/md1 /var/archive ext3 defaults,errors=remount-ro 0 1 /dev/sr0 /mnt/cdrom iso9660 defaults,noauto 0 0 proc /proc proc defaults 0 0 none /proc/bus/usb usbfs defaults 0 0 $ cat /etc/mtab /dev/md0 / ext3 rw,errors=remount-ro 0 0 proc /proc proc rw,relatime 0 0 sysfs /sys sysfs rw,relatime 0 0 tmpfs /dev tmpfs rw,relatime,size=4k,mode=755 0 0 devpts /dev/pts devpts rw,relatime,mode=620 0 0 /dev/md1 /var/archive ext3 rw,errors=remount-ro 0 1 /var/archive/home /home none rw,bind 0 0 /var/archive/spool /var/spool none rw,bind 0 0 /var/archive/www /var/lib/www none rw,bind 0 0 $ df-8.22 -h Filesystem Size Used Avail Use% Mounted on /dev/md0 21G 8.8G 11G 46% / tmpfs 4.0K 0 4.0K 0% /dev And where is /dev/md1 ? running df from coreutils 8.21 shows different result: $ df-8.21 -h Filesystem Size Used Avail Use% Mounted on /dev/md021G 8.8G 11G 46% / tmpfs 4.0K 0 4.0K 0% /dev /var/archive/home 273G 244G 29G 90% /home Still weird. Trying with 8.20: $ df-8.20 -h Filesystem Size Used Avail Use% Mounted on /dev/md0 21G 8.8G 11G 46% / tmpfs 4.0K 0 4.0K 0% /dev /dev/md1273G 244G 29G 90% /var/archive Now ok.