[issue37834] readlink on Windows cannot read app exec links
Steve Dower
report at bugs.python.org
Tue Aug 13 20:15:53 EDT 2019
Steve Dower <steve.dower at python.org> added the comment:
> I'm wary of trying to return it without the prefix.
Me too, but suddenly adding "\\?\" to the paths breaks a lot of assumptions.
> We would need a function that's shared with the proposed implementation of realpath() to determine whether the given path (not the final path) is safe to return as a normal DOS or UNC path.
My idea was to GetFinalPathName(path[4:])[4:] and if that fails, don't strip the prefix. Which is obviously not be perfect, but since we're not going to add a check for the LongPathsEnabled flag (let alone any of the other edge cases), we can't easily figure out whether it's safe to return manually.
I really want a fix for this in 3.8, or else os.stat(sys.executable) may fail, but I don't think changing the result of readlink() is okay at this stage. Maybe I'll leave that out for now and just take the st_reparse_tag and stat() changes?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37834>
_______________________________________
More information about the Python-bugs-list
mailing list