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.

Title: islink and stat follow_symlinks are inconsistent on Windows
Type: enhancement Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2017-01-12 10:42 by eryksun, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (1)
msg285299 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2017-01-12 10:42
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')
    >>> s = os.stat(r'C:\Documents and Settings')
    >>> ls = os.lstat(r'C:\Documents and Settings')
    >>> s.st_ino == ls.st_ino

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


and non-Microsoft tags: 


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.

Date User Action Args
2022-04-11 14:58:41adminsetgithub: 73436
2019-08-22 04:55:31eryksunsetstatus: open -> closed
dependencies: - os.walk always follows Windows junctions
resolution: out of date
stage: needs patch -> resolved
2017-01-12 10:53:22eryksunsetdependencies: + os.walk always follows Windows junctions
2017-01-12 10:42:45eryksuncreate