[issue37834] readlink on Windows cannot read app exec links

Eryk Sun report at bugs.python.org
Mon Aug 12 18:47:52 EDT 2019


Eryk Sun <eryksun at gmail.com> added the comment:

> How about adding a separate function such as nt.read_reparse_point()

If we support reading junctions, this should be using the substitute name (with \??\ replaced by \\?\) instead of the print name. For both symlinks and junctions, [MS-FSCC] 2.1.2 states that the print name SHOULD be informative, not that it MUST be, where SHOULD and MUST are defined by RFC2119. The print name can be non-informative for some reason (e.g. maybe to use the whole 16 KiB buffer for the target path.) For symlinks that's not normally observed, since CreateSymbolicLinkW is conservative. For junctions, applications and frameworks use a low-level IOCTL to set them, and they're not necessarily bothering to set a print name. For example, PowerShell omits it:

    PS C:\Mount> new-item Spam -type junction -value C:\Temp\Spam | out-null
    PS C:\Mount> fsutil.exe reparsepoint query spam
    Reparse Tag Value : 0xa0000003
    Tag value: Microsoft
    Tag value: Name Surrogate
    Tag value: Mount Point
    Substitue Name offset: 0
    Substitue Name length: 32
    Print Name offset:     34
    Print Name Length:     0
    Substitute Name:       \??\C:\Temp\Spam

This mount point works fine despite the lack of a print name.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37834>
_______________________________________


More information about the Python-bugs-list mailing list