X Tutup
The Wayback Machine - https://web.archive.org/web/20250614170151/https://github.com/python/cpython/issues/103593
Skip to content

os.path.splitroot() splits "Global" and "GLOBALROOT" device paths incorrectly #103593

Open
@barneygale

Description

@barneygale

Low priority issue, follow-up from #78079.

On Windows, os.path.splitroot() produces incorrect results for all of the following paths:

>>> from ntpath import splitroot
>>> splitroot('//./Global/Global/UNC')
('//./Global', '/', 'Global/UNC')
>>> splitroot('//./Global/Z:/')
('//./Global', '/', 'Z:/')
>>> splitroot('//?/Global/Z:/')
('//?/Global', '/', 'Z:/')
>>> splitroot('//./Global/UNC')
('//./Global', '/', 'UNC')
>>> splitroot('//?/Global/UNC/server/share/dir')
('//?/Global', '/', 'UNC/server/share/dir')
>>> splitroot('//?/GLOBALROOT/ContainerMappedDirectories/93AA221C-4061-460F-8C4E-A2EAC1BF3324')
('//?/GLOBALROOT', '/', 'ContainerMappedDirectories/93AA221C-4061-460F-8C4E-A2EAC1BF3324')
>>> splitroot('//?/GLOBALROOT/Device/LanManRedirector/abc/xyz')
('//?/GLOBALROOT', '/', 'Device/LanManRedirector/abc/xyz')
>>> splitroot('//?/GLOBALROOT/Device/Mup/abc/xyz')
('//?/GLOBALROOT', '/', 'Device/Mup/abc/xyz')
>>> splitroot('//?/GLOBALROOT/Device/WebDavRedirector/abc/xyz')
('//?/GLOBALROOT', '/', 'Device/WebDavRedirector/abc/xyz')
>>> splitroot('//?/GLOBALROOT/DosDevices/UNC/abc/xyz')
('//?/GLOBALROOT', '/', 'DosDevices/UNC/abc/xyz')
>>> splitroot('//?/GLOBALROOT/??/UNC/abc/xyz')
('//?/GLOBALROOT', '/', '??/UNC/abc/xyz')

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixesOS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup