GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `os.path.splitroot()` splits "Global" and "GLOBALROOT" device paths incorrectly · Issue #103593 · python/cpython

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

New issue
Copy link
New issue
Copy link
Open
Open
os.path.splitroot() splits "Global" and "GLOBALROOT" device paths incorrectly#103593
Copy link
Labels
3.12only security fixesonly security fixes3.13only security fixesonly security fixesOS-windowstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@barneygale
barneygale
opened on Apr 17, 2023
Issue body actions

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')

Activity

  1. barneygale
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.12only security fixesonly security fixes
    on Apr 17, 2023
  2. eryksun commented on Apr 17, 2023

    @eryksun
    eryksun
    on Apr 17, 2023
    Contributor
    More actions

    The "Global" qualifier would be consumed as part of the "\\.\" or "\\?\" device prefix. Using "Global" ensures that only system device names are found, bypassing local device names created in the current logon session via WinAPI DefineDosDeviceW() or NTAPI NtCreateSymbolicLinkObject(). Repeated "Global" qualifiers don't have to be supported.

    "GlobalRoot" can be handled like the "UNC" device, by consuming up to two subsequent components, e.g "\\.\GlobalRoot\Device\HarddiskVolume2". An exception could be made to consume up to two more components if the path is on the multiple UNC device (MUP), e.g. "\\?\GlobalRoot\Device\Mup\server\share". Such a path might me returned by os.readlink() if the symlink is absolute (no relative flag) and directly targets "\Device\Mup" instead of "\??\UNC". Or maybe a script is manipulating NT paths from GetFinalPathNameByHandleW(), for example:

    >>> h = CreateFile('//localhost/C$/Windows/py.exe', 0, 0, None, 3, 0, None)
    >>> p = GetFinalPathNameByHandle(h, VOLUME_NAME_NT)
    >>> p = '\\\\?\\GlobalRoot' + p
    >>> p
    '\\\\?\\GlobalRoot\\Device\\Mup\\localhost\\C$\\Windows\\py.exe'
    >>> h2 = CreateFile(p, 0, 0, None, 3, 0, None)
    >>> GetFinalPathNameByHandle(h2, VOLUME_NAME_DOS)
    '\\\\?\\UNC\\localhost\\C$\\Windows\\py.exe'
    Reacted by Barney Gale
  3. eryksun
    added
    OS-windows
    3.13only security fixesonly security fixes
    on Apr 17, 2023
  4. serhiy-storchaka
    added this to OS issues 💻on Jul 3, 2026
  5. github-project-automation
    moved this to Todo in OS issues 💻on Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    • OS issues 💻
      Status
      Todo
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.