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, simon mackenzie, steve.dower, tim.golden, zach.ware
Date 2021-01-18.21:25:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611005121.16.0.27754348191.issue42957@roundup.psfhosted.org>
In-reply-to
Content
Symlinks and mountpoints (aka junctions) contain two forms of the target path. There's a path that's intended for display in the shell, and there's the actual substitute path to which the link resolves. os.readlink() was changed to return the substitute path because the display form is not mandated by filesystem protocols (it's sometimes missing, especially for junctions) and not reliable (e.g. the display path may be a long path or contain reserved names such that it's not valid without the \\?\ prefix). It was decided to keep the C implementation of os.readlink() simple. Whether to retain the \\?\ prefix was shifted to high-level functions that consume the result of os.readlink(), such as os.path.realpath().

There was a previous issue related to this, in that the shutil module copies symlinks via os.readlink() and os.symlink(), which thus copies only the substitute path now. The issue was closed as not a bug, but had it been resolved with new functionality, I would have preferred to do so with a low-level function to copy a reparse point, not by reverting the behavior of os.readlink(). I also see no reason against adding an option to readlink() to return the display path instead of the substitute path, or to just remove the prefix. But I'd vote against making it the default behavior.
History
Date User Action Args
2021-01-18 21:25:21eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, simon mackenzie
2021-01-18 21:25:21eryksunsetmessageid: <1611005121.16.0.27754348191.issue42957@roundup.psfhosted.org>
2021-01-18 21:25:21eryksunlinkissue42957 messages
2021-01-18 21:25:20eryksuncreate