[issue1713] posixpath.ismount() claims symlink to a mountpoint is a mountpoint.

Christian Heimes report at bugs.python.org
Mon Dec 31 14:26:06 CET 2007


Christian Heimes added the comment:

A fix for the problem is easy. One has to replace os.stat() with os.lstat():

def ismount(path):
    """Test whether a path is a mount point"""
    try:
        s1 = os.stat(path)
        s2 = os.stat(join(path, '..'))
    except os.error:
        return False # It doesn't exist -- so not a mount point :-)
    dev1 = s1.st_dev
    dev2 = s2.st_dev
    if dev1 != dev2:
        return True     # path/.. on a different device as path
    ino1 = s1.st_ino
    ino2 = s2.st_ino
    if ino1 == ino2:
        return True     # path/.. is the same i-node as path
    return False

----------
nosy: +tiran
priority:  -> low
versions: +Python 2.6, Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1713>
__________________________________


More information about the Python-bugs-list mailing list