[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix

Steve Dower report at bugs.python.org
Thu Feb 11 13:48:57 EST 2016


Steve Dower added the comment:

Paths prefixed with "\\?\" also need to be normalized, not just absolute. AFAIK there are no official docs on what normalization is required, but it includes at least trimming trailing dots on directory names, removing "." and ".." sections, adjacent backslashes, and removing trailing spaces on any segment.

Without this, you will access/create/etc. files that users cannot otherwise see or modify.

I don't disagree that we should add the prefix for long paths, but we need to at least get most of the normalization correct so that cases like this work:

>>> open('C:\\Dir \\file.txt.', 'r').read()
"Content"
>>> open('\\\\?\\C:\\Dir \\file.txt.', 'r').read()
FileNotFoundError: [Errno 2] No such file or directory: '\\\\?\\C:\\Dir \\file.txt.'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18199>
_______________________________________


More information about the Python-bugs-list mailing list