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 ronaldoussoren
Recipients brian.curtin, heikki, nadeem.vawda, nooB, orsenthil, python-dev, ronaldoussoren, santoso.wijaya, tarek, tim.golden
Date 2011-05-06.14:34:43
SpamBayes Score 2.8571554e-09
Marked as misclassified No
Message-id <1304692485.09.0.31472123634.issue10684@psf.upfronthosting.co.za>
In-reply-to
Content
This seems to be a bug in ntpath.samefile, in particular in this code:


# determine if two files are in fact the same file
try:
    # GetFinalPathNameByHandle is available starting with Windows 6.0.
    # Windows XP and non-Windows OS'es will mock _getfinalpathname.
    if sys.getwindowsversion()[:2] >= (6, 0):
        from nt import _getfinalpathname
    else:
        raise ImportError
except (AttributeError, ImportError):
    # On Windows XP and earlier, two files are the same if their absolute
    # pathnames are the same.
    # Non-Windows operating systems fake this method with an XP
    # approximation.
    def _getfinalpathname(f):
        return abspath(f)

def samefile(f1, f2):
    "Test whether two pathnames reference the same actual file"
    return _getfinalpathname(f1) == _getfinalpathname(f2)

Python2 doesn't have ntpath.samefile and shutil then falls back to comparing "os.path.normcase(os.path.abspath(src))" with the same transformation of dst.

On XP _getfinalpath doesn't call os.path.normcase, hence it doesn't notice that "a" and "A" refer to the same file (on all common NT filesystems)
History
Date User Action Args
2011-05-06 14:34:45ronaldoussorensetrecipients: + ronaldoussoren, orsenthil, tim.golden, nadeem.vawda, heikki, tarek, brian.curtin, santoso.wijaya, nooB, python-dev
2011-05-06 14:34:45ronaldoussorensetmessageid: <1304692485.09.0.31472123634.issue10684@psf.upfronthosting.co.za>
2011-05-06 14:34:44ronaldoussorenlinkissue10684 messages
2011-05-06 14:34:43ronaldoussorencreate