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 cgohlke, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-08-31.12:54:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1567256065.22.0.928887206478.issue37993@roundup.psfhosted.org>
In-reply-to
Content
>    >>> sys.executable
>    'X:\\Python38\\python.exe'
>    >>> os.path.realpath(sys.executable)
>    '\\\\SERVER\\Programs\\Python38\\python.exe'

Unix Python resolves the executable path with repeated _Py_wreadlink calls. Windows Python should do something similar to ensure the consistency of sys.executable with realpath(sys.executable).

> different from mapped network and subst drives (AFAIU).

Mapped and subst drives are implemented as object-manager symlinks to file-system directories. For example, a subst drive "S:" might target a local directory such as r"\??\C:\Temp\Subst", and a mapped drive "M:" for an SMB share might target a path such as r"\Device\LanmanRedirector\;M:<logon session>\Server\Share\Temp\Mapped". 

The root directory of these drives does not behave like a real root directory unless the drive targets the root of a volume or UNC share, such as "\\??\\C:\\" or r"\Device\LanmanRedirector;M:<logon session>\Server\Share".

This means that in many cases it's possible to evaluate a relative symlink that traverses above the drive root via ".." components. Say we have a directory r"C:\Temp\Subst" that contains a relative symlink "foo_link" that targets r"..\foo". If we map "S:" to r"C:\Temp\Subst", then r"S:\foo_link" opens r"C:\Temp\foo". Similarly if we map r"\\localhost\C$\Temp\Subst" to "M:", then r"M:\foo_link" opens r"C:\Temp\foo".

In the above case, if we're using relpath() to compute the relative path to the "foo" target, I think we want relpath(realpath('C:/Temp/foo'), realpath('S:/')) to succeed as r"..\foo". I don't think we want it to fail as a cross-drive relative path.
History
Date User Action Args
2019-08-31 12:54:25eryksunsetrecipients: + eryksun, paul.moore, tim.golden, cgohlke, zach.ware, steve.dower
2019-08-31 12:54:25eryksunsetmessageid: <1567256065.22.0.928887206478.issue37993@roundup.psfhosted.org>
2019-08-31 12:54:25eryksunlinkissue37993 messages
2019-08-31 12:54:24eryksuncreate