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 eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2017-01-12.10:42:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484217765.9.0.444376233166.issue29250@psf.upfronthosting.co.za>
In-reply-to
Content
win32_xstat_impl in Modules/posixmodule.c doesn't check the value of reparse_tag to limit traversal to only tags that are considered links. So we have cases in which os.path.islink returns False (e.g. junctions, pending the resolution of issue 23407), but os.stat and os.lstat disagree. For example:

    >>> os.path.islink(r'C:\Documents and Settings')
    False
    >>> s = os.stat(r'C:\Documents and Settings')
    >>> ls = os.lstat(r'C:\Documents and Settings')
    >>> s.st_ino == ls.st_ino
    False

At its strictest, traversal would be limited to just symbolic links. It could be relaxed to also include junctions, and even further to include all tags with the name surrogate bit set [1]. This includes the following Microsoft tags

    IO_REPARSE_TAG_MOUNT_POINT (junctions)
    IO_REPARSE_TAG_SYMLINK
    IO_REPARSE_TAG_IIS_CACHE

and non-Microsoft tags: 

    IO_REPARSE_TAG_SOLUTIONSOFT
    IO_REPARSE_TAG_OSR_SAMPLE
    IO_REPARSE_TAG_QI_TECH_HSM
    IO_REPARSE_TAG_MAXISCALE_HSM

I'm creating this issue as an enhancement for 3.7. The problem has existed for a long time, but it hasn't been a thorn in anyone's side as far as I know.

[1]: https://msdn.microsoft.com/en-us/library/aa365511
History
Date User Action Args
2017-01-12 10:42:45eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower
2017-01-12 10:42:45eryksunsetmessageid: <1484217765.9.0.444376233166.issue29250@psf.upfronthosting.co.za>
2017-01-12 10:42:45eryksunlinkissue29250 messages
2017-01-12 10:42:45eryksuncreate