GNU bug report logs - #17833
coreutils 8.22 df

Previous Next

Package: coreutils;

Reported by: "Gabor Z. Papp" <gzp <at> papp.hu>

Date: Sun, 22 Jun 2014 16:29:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17833 in the body.
You can then email your comments to 17833 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Sun, 22 Jun 2014 16:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Gabor Z. Papp" <gzp <at> papp.hu>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 22 Jun 2014 16:29:02 GMT) Full text and rfc822 format available.

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

From: "Gabor Z. Papp" <gzp <at> papp.hu>
To: bug-coreutils <at> gnu.org
Subject: coreutils 8.22 df
Date: Sun, 22 Jun 2014 10:41:29 +0200
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/md0            21G  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/md1        273G  244G   29G  90% /var/archive

Now ok.




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Wed, 25 Jun 2014 09:18:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: "Gabor Z. Papp" <gzp <at> papp.hu>
Cc: 17833 <at> debbugs.gnu.org
Subject: Re: bug#17833: coreutils 8.22 df
Date: Wed, 25 Jun 2014 10:17:30 +0100
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/md0            21G  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/md1        273G  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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Wed, 25 Jun 2014 12:25:02 GMT) Full text and rfc822 format available.

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

From: "Gabor Z. Papp" <gzp <at> papp.hu>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 17833 <at> debbugs.gnu.org
Subject: Re: bug#17833: coreutils 8.22 df
Date: Wed, 25 Jun 2014 14:24:04 +0200
* Pádraig Brady <P <at> draigBrady.com>:

| > $ 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/md0            21G  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/md1        273G  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




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Tue, 08 Jul 2014 17:30:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: "Gabor Z. Papp" <gzp <at> papp.hu>
Cc: 17833 <at> debbugs.gnu.org, bug-gnulib <bug-gnulib <at> gnu.org>
Subject: Re: bug#17833: coreutils 8.22 df
Date: Tue, 08 Jul 2014 18:28:51 +0100
[Message part 1 (text/plain, inline)]
On 06/25/2014 01:24 PM, Gabor Z. Papp wrote:
> * Pádraig Brady <P <at> draigBrady.com>:
> 
> | > $ 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/md0            21G  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/md1        273G  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.

[gnulib-hasmntopt.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Wed, 09 Jul 2014 09:19:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: "Gabor Z. Papp" <gzp <at> papp.hu>
Cc: 17833 <at> debbugs.gnu.org, bug-gnulib <bug-gnulib <at> gnu.org>
Subject: Re: bug#17833: coreutils 8.22 df
Date: Wed, 09 Jul 2014 10:18:48 +0100
[Message part 1 (text/plain, inline)]
Apologies for resend. GNU mailers were having issues yesterday...

On 06/25/2014 01:24 PM, Gabor Z. Papp wrote:
> * Pádraig Brady <P <at> draigBrady.com>:
> 
> | > $ 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/md0            21G  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/md1        273G  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.


[gnulib-hasmntopt.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Wed, 09 Jul 2014 10:07:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: "Gabor Z. Papp" <gzp <at> papp.hu>
Cc: 16189-done <at> debbugs.gnu.org, 17833 <at> debbugs.gnu.org,
 Andrew D Warshall <warshall <at> 99main.com>, bug-gnulib <bug-gnulib <at> gnu.org>
Subject: Re: bug#17833: coreutils 8.22 df
Date: Wed, 09 Jul 2014 11:06:13 +0100
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 <P <at> draigBrady.com>:
>>
>> | > $ 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.





Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Thu, 10 Jul 2014 23:29:01 GMT) Full text and rfc822 format available.

Notification sent to "Gabor Z. Papp" <gzp <at> papp.hu>:
bug acknowledged by developer. (Thu, 10 Jul 2014 23:29:02 GMT) Full text and rfc822 format available.

Message #25 received at 17833-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: "Gabor Z. Papp" <gzp <at> papp.hu>
Cc: 17833-done <at> debbugs.gnu.org
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 00:28:34 +0100
[Message part 1 (text/plain, inline)]
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 <P <at> draigBrady.com>:
>>
>> | > $ 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/md0            21G  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/md1        273G  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.
[df-real-devices.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Fri, 11 Jul 2014 00:22:02 GMT) Full text and rfc822 format available.

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 17833 <at> debbugs.gnu.org, P <at> draigBrady.com, gzp <at> papp.hu
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 02:20:29 +0200
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Fri, 11 Jul 2014 08:34:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 17833 <at> debbugs.gnu.org, gzp <at> papp.hu
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 09:32:50 +0100
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.





Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Fri, 11 Jul 2014 08:40:02 GMT) Full text and rfc822 format available.

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

From: "Gabor Z. Papp" <gzp <at> papp.hu>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 17833 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 10:39:46 +0200
* Pádraig Brady <P <at> draigBrady.com>:

| > 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




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Fri, 11 Jul 2014 08:45:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: "Gabor Z. Papp" <gzp <at> papp.hu>
Cc: 17833 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 09:44:16 +0100
On 07/11/2014 09:39 AM, Gabor Z. Papp wrote:
> * Pádraig Brady <P <at> draigBrady.com>:
> 
> | > 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




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Fri, 11 Jul 2014 09:00:03 GMT) Full text and rfc822 format available.

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

From: "Gabor Z. Papp" <gzp <at> papp.hu>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 17833 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 10:59:41 +0200
* Pádraig Brady <P <at> draigBrady.com>:

| > $ 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.'




Information forwarded to bug-coreutils <at> gnu.org:
bug#17833; Package coreutils. (Fri, 11 Jul 2014 16:35:02 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: 17833 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigbrady.com>,
 gzp <at> papp.hu
Subject: Re: bug#17833: coreutils 8.22 df
Date: Fri, 11 Jul 2014 09:33:58 -0700
On Thu, Jul 10, 2014 at 4:28 PM, Pádraig Brady <P <at> draigbrady.com> 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 archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 09 Aug 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 263 days ago.

Previous Next


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