Skip to content

gh-89760: Fix os.path.realpath() for volume GUID paths on Windows - #155396

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-89760-realpath-volume-guid
Open

gh-89760: Fix os.path.realpath() for volume GUID paths on Windows#155396
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-89760-realpath-volume-guid

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

If a junction points to a directory on a volume which has no drive letter, os.path.realpath() returned a path like Volume{<uuid>}\dir, without the \\?\ prefix, which is invalid and even looks relative.

The prefix was stripped because the check that the non-prefixed path resolves to the same path failed with the same error as the original path.

The prefix is now only stripped for drive-letter and UNC paths, as suggested by @eryksun.

The \\?\ prefix was stripped from the resolved path if it could not be
resolved without the prefix and failed with the same error as the original
path. This produced an invalid, seemingly relative path for a junction
which points to a volume without a drive letter. The prefix is now only
stripped for drive-letter and UNC paths.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core reviewneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixesneeds backport to 3.15pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@serhiy-storchaka