fix: windows drive letters remap to unc paths#2104
Open
maxnbk wants to merge 6 commits into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2104 +/- ##
==========================================
+ Coverage 60.65% 60.69% +0.04%
==========================================
Files 164 164
Lines 20584 20630 +46
Branches 3579 3593 +14
==========================================
+ Hits 12485 12522 +37
- Misses 7224 7228 +4
- Partials 875 880 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…is remapped by rez to a UNC path Signed-off-by: Stephen Mackenzie <maxnbk@users.noreply.github.com>
…repository filesystem to ensure its consumption Signed-off-by: Stephen Mackenzie <maxnbk@users.noreply.github.com>
…-compatible symlink/junction-point resolution behavior Signed-off-by: Stephen Mackenzie <maxnbk@users.noreply.github.com>
…ion-behavior intended to produce realpath-like behavior Signed-off-by: Stephen Mackenzie <maxnbk@users.noreply.github.com>
ae4aeb2 to
92b2b07
Compare
…support in optional symlink-resolution for windows Signed-off-by: Stephen Mackenzie <maxnbk@users.noreply.github.com>
…ath-aware. Signed-off-by: Stephen Mackenzie <maxnbk@users.noreply.github.com>
92b2b07 to
1681466
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2045 and #1438 .
Partial but not complete fix for #1909 (Intentional, I feel that the work that was occurring in the gitbash PR would ultimately resolve this behavior?) .
Explanations:
os.path.realpathon Python 3.8+ Windows silently expands mapped drive letters to their underlying UNC paths. Becausecanonical_pathcallsrealpath,FileSystemPackageRepositorywas storing a UNCself.locationeven when the caller supplied a drive-letter path. This causedmake_resource_handle, which does a raw string comparison, to raiseResourceErroron every drive-letter handle against a UNC-stored repository.The fix:
On Windows,
canonical_pathnow usesos.path.abspathinstead ofos.path.realpath. This preserves path style (drive-letter stays drive-letter, UNC stays UNC) and restores the pre-3.8 normalization behavior without a network-resolution side-effect. Amake_resource_handleoverride is also added to thefilesystemplugin to handle residual case or separator mismatches viacanonical_path.Extension of work:
A
resolve_links_on_windowsconfig flag (defaultFalse) has been added for sites that need some form of symlink/junction resolution on Windows. When enabled, a purpose-built_windows_realpathwalks components of the path usingos.readlink, resolving real symlinks without actually touching the drive root, in order to avoid the UNC-expansion side-effect entirely. Long-path support (\\?\prefix handling) is included, with the relevant test skipped on hosts that do not haveLongPathsEnabled=1in the registry. Note: I'm aware that we need to move off of the winreg module, but since we have it for now, might as well use it.Testing:
This was tested against an actual Drive-letter-map-with-matching-UNC-network-share .
Disclosure:
This PR was AI-assisted with Claude Code, Sonnet 4.6, primarily for diagnostics, logic-tracing, documentation and edge-case verification.