This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eike, eryksun, jstasiak, serhiy.storchaka
Date 2020-04-22.17:15:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587575733.66.0.800760446296.issue37339@roundup.psfhosted.org>
In-reply-to
Content
> 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`).
History
Date User Action Args
2020-04-22 17:15:33eryksunsetrecipients: + eryksun, serhiy.storchaka, jstasiak, eike
2020-04-22 17:15:33eryksunsetmessageid: <1587575733.66.0.800760446296.issue37339@roundup.psfhosted.org>
2020-04-22 17:15:33eryksunlinkissue37339 messages
2020-04-22 17:15:33eryksuncreate