[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

Alex Richman report at bugs.python.org
Thu Aug 31 13:30:18 EDT 2017


Alex Richman added the comment:

Can confirm, ran into this issue.  It's because os.path.ismount() works by checking if the path's parent is on a different device (e.g. st_dev is the same for 'path/' and 'path/..'), which obviously it is for a bind mount on the same filesystem.

It is actually documented that this is how it works (https://docs.python.org/2/library/os.path.html#os.path.ismount) but it's more of a passing comment than a warning, and who reads the docs for such an apparently simple function anyway? ;)

Agree that it should be fixed by parsing /proc/mounts instead of the current mess, perhaps using getmntent(3) and friends.

----------
nosy: +Alex Richman

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29707>
_______________________________________


More information about the Python-bugs-list mailing list