New submission from Eryk Sun: 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 ---------- components: Library (Lib), Windows messages: 285299 nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: islink and stat follow_symlinks are inconsistent on Windows type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29250> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com