fix: windows drive letters remap to unc paths#2104
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
|
@maxnbk What's the relationship to #1856? During the TSC, @instinct-vfx said that the expected default behavior is that the style should stay consistent based on how the repo was configured? |
|
Can you please look at #1856. There are a few other places that realpath needs to be replaced. |
|
I'll take a look and see what else needs resolving. I may have to add some more tests to find all the edge-cases. Goal is to incorporate all solutions from all mismatched PRs, as I think there were approximately 3 all trying to solve the same problem with partial/incomplete solutions, and nobody got all corners. Evidently that extends to me, so I'll re-evaluate and see what I need to do to extend. |
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.