[issue41705] os.makedirs fails on long-path UNC-paths if it is the first sub-folder
Eryk Sun
report at bugs.python.org
Thu Sep 3 18:01:32 EDT 2020
Eryk Sun <eryksun at gmail.com> added the comment:
This behavior is due to issue 37609, i.e. ntpath.splitdrive fails for "UNC" device paths.
>>> ntpath.splitdrive('//?/UNC/server/share')
('//?/UNC', '/server/share')
The result should be "//?/UNC/server/share". A path on the "UNC" device requires a share component, on which is mounted a local or remote filesystem directory. It's functionally part of the 'drive' path. Using just the root path or a server path on the "UNC" device is malformed in the context of a normal file API open. The former fails as ERROR_INVALID_NAME (123), and the latter fails as ERROR_BAD_PATHNAME (161).
The incorrect splitdrive result in turn makes ntpath.split misbehave:
>>> ntpath.split('//?/UNC/server/share')
('//?/UNC/server', 'share')
>>> ntpath.split('//?/UNC/server')
('//?/UNC/', 'server')
The correct result should be ('//?/UNC/server/share', '').
----------
nosy: +eryksun
type: crash -> behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41705>
_______________________________________
More information about the Python-bugs-list
mailing list