GNU bug report logs -
#25173
stat -c%m and bind mounts
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
stat -c%m does not seem to work correctly with bind mounts.
I have tested the following on Debian Jessie:
# mkdir /home/root ; touch /home/zero
# mount -o bind /root /home/root
# mount -o bind /dev/zero /home/zero
# mount -o bind /tmp /tmp
# ./src/df -P /home/root /home/zero /tmp
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda1 7736784 2431152 4889584 34% /home/root
udev 10240 0 10240 0% /home/zero
/dev/sda1 7736784 2431152 4889584 34% /tmp
# ./src/stat -c%m /home/root /home/zero /tmp
/
/
/
# ./src/stat --version
stat (GNU coreutils) 8.26.4-ca52f
The documentation explains:
stat outputs the alias for a bind mounted file, rather than the
initial mount point of its backing device. One can recursively call
stat until there is no change in output, to get the current base mount
point
(https://www.gnu.org/software/coreutils/manual/html_node/stat-invocation.html#index-bind-mount-1)
At least the documentation does not match the result. Note that the
documented behaviour would not work for /tmp bind mounted to itself.
But I also would expect to see /dev as the mount point of /home/zero
in the example above.
Related: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6555#76
--
Best regards,
Wim
This bug report was last modified 8 years and 193 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.