Message367028
> What do you mean by "portable version of mountpoint"?
posixpath.ismount is based on a portable method to detect a mountpoint in Unix systems, since POSIX lacks a portable function for this. The implementation is simple. A symlink is never a mountpoint. Otherwise compare the lstat of the path and its parent directory. It's a mountpoint if the st_dev fields are different. If not, it's a mountpoint if the st_ino fields are the same (e.g. "/").
The portable method may fail in particular cases. For instance, a bind mount in the Linux kernel (not bindfs) doesn't create a new device. For example, given "/opt" is bound to "opt" in the current directory on the same filesystem, ismount returns a false negative:
>>> posixpath.ismount('opt')
False
But it's a mountpoint according to the "/proc/self/mountinfo" table:
>>> os.system('mountpoint opt')
opt is a mountpoint
0
The above false negative is documented, so a precedent exists to simply document the false positive with a btrfs subvolume. Developers can make of it what they will. If it matters to not count this case as a mountpoint, a script will have to implement its own platform-specific solution (e.g. use subprocess to call `mountpoint`). |
|
Date |
User |
Action |
Args |
2020-04-22 17:15:33 | eryksun | set | recipients:
+ eryksun, serhiy.storchaka, jstasiak, eike |
2020-04-22 17:15:33 | eryksun | set | messageid: <1587575733.66.0.800760446296.issue37339@roundup.psfhosted.org> |
2020-04-22 17:15:33 | eryksun | link | issue37339 messages |
2020-04-22 17:15:33 | eryksun | create | |
|