GNU bug report logs -
#8208
Possible bug for df
Previous Next
Full log
Message #10 received at 8208-done <at> debbugs.gnu.org (full text, mbox):
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.
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.