GNU bug report logs - #8208
Possible bug for df

Previous Next

Package: coreutils;

Reported by: Jesse Molina <jesse <at> opendreams.net>

Date: Wed, 9 Mar 2011 13:51: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 8208 in the body.
You can then email your comments to 8208 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 owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8208; Package coreutils. (Wed, 09 Mar 2011 13:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jesse Molina <jesse <at> opendreams.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 09 Mar 2011 13:51:02 GMT) Full text and rfc822 format available.

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

From: Jesse Molina <jesse <at> opendreams.net>
To: bug-coreutils <at> gnu.org
Subject: Possible bug for df
Date: Wed, 09 Mar 2011 02:36:31 -0700
The "df" tool will mismatch mounted devices when a specific device 
parameter is specified.

Here's some console output from running df;

[/var/log]
shara <at> sorrows-->df -h /dev/md5
Filesystem            Size  Used Avail Use% Mounted on
/dev/md5              2.3T  1.7T  534G  76% /mnt/backup/bak5
[/var/log]
shara <at> sorrows-->df -h /dev/md5
Filesystem            Size  Used Avail Use% Mounted on
udev                  881M  372K  880M   1% /dev



In the second invocation, the /dev/md5 device had been dismounted, but 
the /dev filesystem is now being matched, when it should not be.

Expected behavior is to get non-zero exit code and print nothing, and/or 
an error on stderr that the device is not found.

Note that this was to be used in a script.  I tried with the -P flag, 
and the behavior is the same, in that the wrong mount is matched.



shara <at> sorrows-->df --version
df (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Paul Eggert.


Also FYI

shara <at> sorrows-->df -v
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/sor--vg1-root
                       8256952   3884136   4288932  48% /
tmpfs                   906132         4    906128   1% /lib/init/rw
udev                    901260       372    900888   1% /dev
tmpfs                   906132         4    906128   1% /dev/shm
/dev/md0                241036    108803    107344  51% /boot
/dev/mapper/sor--vg1-tmp
                       2064208     71112   1888240   4% /tmp
/dev/mapper/sor--vg1-var
                     1906616172 621163644 1266103904  33% /var
/dev/mapper/sor--vg1-var--log
                       4128448   2038268   2090180  50% /var/log



No reply needed.  Sorry if this is duplicate or expected behavior.



-- 
# Jesse Molina
# Mail = jesse <at> opendreams.net
# Page = page-jesse <at> opendreams.net
# Cell = 1.602.323.7608
# Web  = http://www.opendreams.net/jesse/






Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Wed, 09 Mar 2011 16:23:02 GMT) Full text and rfc822 format available.

Notification sent to Jesse Molina <jesse <at> opendreams.net>:
bug acknowledged by developer. (Wed, 09 Mar 2011 16:23:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Jesse Molina <jesse <at> opendreams.net>
Cc: 8208-done <at> debbugs.gnu.org
Subject: Re: bug#8208: Possible bug for df
Date: Wed, 09 Mar 2011 16:20:54 +0000
On 09/03/11 09:36, Jesse Molina wrote:
> 
> The "df" tool will mismatch mounted devices when a specific device
> parameter is specified.
> 
> Here's some console output from running df;
> 
> [/var/log]
> shara <at> sorrows-->df -h /dev/md5
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/md5              2.3T  1.7T  534G  76% /mnt/backup/bak5
> [/var/log]
> shara <at> sorrows-->df -h /dev/md5
> Filesystem            Size  Used Avail Use% Mounted on
> udev                  881M  372K  880M   1% /dev
> 
> 
> 
> In the second invocation, the /dev/md5 device had been dismounted, but
> the /dev filesystem is now being matched, when it should not be.
> 
> Expected behavior is to get non-zero exit code and print nothing, and/or
> an error on stderr that the device is not found.
> 
> Note that this was to be used in a script.  I tried with the -P flag,
> and the behavior is the same, in that the wrong mount is matched.

This is expected behavior. If the passed file is not a mount point itself,
df will go and find it's mount point, and report for that device.

If you want to enforce that the passed device node is mounted
then I suggest you ensure that the file system is the same as passed, like:

dev=/dev/md5
df_dev=$(df -P $dev | sed -n '2s/\([^ ]*\).*/\1/p')
test "$dev" = "$df_dev" || { echo "$dev not mounted" >&2; exit 1; }

cheers,
Pádraig.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 07 Apr 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 79 days ago.

Previous Next


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