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.

classification
Title: posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.4, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, drougge, gvanrossum
Priority: low Keywords:

Created on 2007-12-31 02:24 by drougge, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg59056 - (view) Author: Carl Drougge (drougge) * Date: 2007-12-31 02:35
Sorry, this happened to me in /tmp, where it's actually true, except I 
don't expect symlinks to be considered mountpoints, so I still consider 
it a bug. Should have tested more though.
msg59059 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-31 13:26
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
msg59073 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-01-01 19:05
Go ahead then!
msg59221 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-04 13:23
Fixed in r59709 (trunk) and r59710 (2.5)
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46054
2008-01-04 13:23:11christian.heimessetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg59221
2008-01-01 19:05:23gvanrossumsetassignee: christian.heimes
resolution: accepted
messages: + msg59073
nosy: + gvanrossum
2007-12-31 13:26:06christian.heimessetpriority: low
nosy: + christian.heimes
messages: + msg59059
versions: + Python 2.6, Python 3.0
2007-12-31 02:35:38drouggesetmessages: + msg59056
title: posixpath.ismount() claims symlink to .. is mountpoint. -> posixpath.ismount() claims symlink to a mountpoint is a mountpoint.
2007-12-31 02:24:02drouggecreate