[issue39312] Expose placeholder reparse points in Windows

Eryk Sun report at bugs.python.org
Tue Jan 14 13:08:32 EST 2020


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

Okay, a well-known third-party library will work if a script/application really needs this information. I just wanted to bring it up for consideration because I saw an issue for cross-platform PowerShell 6 [1] where it was decided to disable placeholder disguising, but that particular decision was motivated by the need to remain compatible with Windows PowerShell 5.

[1] https://github.com/PowerShell/PowerShell/pull/8745

> Recalling our debates about symlinks, I'd have to say that nothing 
> about placeholder files qualifies them as links, regardless of 
> whether Powershell puts "l" in the attributes summary :)

Certainly. A link (broadly speaking, including Unix-style symlinks and mount points) has to be a name surrogate. These OneDrive reparse points do not have the [N]ame surrogate bit set. It's not even allowed to be set because they have the [D]irectory bit set, which allows the directory entry in the filesystem to contain files. This is explained in km\ntifs.h:


    // The reparse tags are a ULONG. The 32 bits are laid out as follows:
    //
    //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
    //   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
    //  +-+-+-+-+-----------------------+-------------------------------+
    //  |M|R|N|D|     Reserved bits     |       Reparse Tag Value       |
    //  +-+-+-+-+-----------------------+-------------------------------+
    //
    // M is the Microsoft bit. When set to 1, it denotes a tag owned by Microsoft.
    //   All ISVs must use a tag with a 0 in this position.
    //   Note: If a Microsoft tag is used by non-Microsoft software, the
    //   behavior is not defined.
    //
    // R is reserved.  Must be zero for non-Microsoft tags.
    //
    // N is name surrogate. When set to 1, the file represents another named
    //   entity in the system.
    //
    // D is the directory bit. When set to 1, indicates that any directory
    //   with this reparse tag can have children. Has no special meaning when used
    //   on a non-directory file. Not compatible with the name surrogate bit.

----------

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


More information about the Python-bugs-list mailing list