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 steve.dower
Recipients eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-08-15.21:28:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> So we _do_ want to "upgrade" lstat() to stat() when it's not a symlink.

Except this bug came about because we want to _downgrade_ stat() to lstat() when it's an appexeclink, because the whole point of those is to use them without following them (and yeah, most operations are going to fail, but they'd fail against the target file too).

So we have this logic:

def xstat(path, traverse):
    f = open(path, flags | (0 if traverse else OPEN_REPARSE_POINT))
    if !f:
        # Special case for appexeclink
        if traverse and ERROR_CANT_OPEN_FILE:
            st = xstat(path, !traverse)
            if st.reparse_tag == APPEXECLINC:
                return st
            raise ERROR_CANT_OPEN_FILE
        # Handle "likely" errors
            st = read_from_dir(os.path.split(path))
        st = read_from_file(f)

    # Always make the OS resolve "unknown" reparse points
    if !traverse and st.reparse_tag not in ALLOWED_TO_TRAVERSE:
        return xstat(path, !traverse)

    return st

And the open question is just whether MOUNT_POINT should be in that set near the end. I believe it should, since the alternative is to force all Python developers to write special Windows-only code to handle directory junctions.
Date User Action Args
2019-08-15 21:28:20steve.dowersetrecipients: + steve.dower, paul.moore, tim.golden, zach.ware, eryksun
2019-08-15 21:28:20steve.dowersetmessageid: <>
2019-08-15 21:28:20steve.dowerlinkissue37834 messages
2019-08-15 21:28:19steve.dowercreate