Repository navigation
Conversation
johnwparent
self-requested a review
October 23, 2026 16:07
johnwparent
requested changes
Oct 23, 2026
johnwparent
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this! Looks pretty good and catches a bone-headed bug I added.
Just a couple of small things
…n_longpath str.lstrip removes any leading backslashes and question marks, not the '\?\' prefix, so a UNC path such as \server\share lost its leading backslashes. Compare the prefix instead, and map the '\?\UNC\' form back to a regular UNC path.
kayaal34
force-pushed
the
fix-sanitize-win-longpath
branch
from
October 26, 2026 10:44
d43d528 to
9259982
Compare
Author
|
Thanks for the review, @johnwparent. Updated (force-pushed, still one commit):
All 12 cases pass; against the previous revision of this PR three of them fail (lower-case |
johnwparent
approved these changes
Oct 26, 2026
johnwparent
left a comment
Contributor
There was a problem hiding this comment.
Looks good now, thanks!
Contributor
|
Thanks for the interest in Spack on Windows @kayaal34! Please don't hesitate to reach out on our Spack on Windows slack channel if you have any other questions. |
This branch has not been deployed
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.
sanitize_win_longpathusedpath.lstrip("\\\\?\\").str.lstriptakes a set of characters, not a prefix, so it removes every leading\and?:\\?\C:\spack\optC:\spack\optC:\spack\opt\\server\share\spack(UNC, no prefix)server\share\spack\\server\share\spack\\?\UNC\server\share\spackUNC\server\share\spack\\server\share\spack?dir\filedir\file?dir\fileIt is used by
_windows_readlink, so on Windows a symlink pointing to a network share came back as a relative-lookingserver\share\...(orUNC\server\...whenos.readlinkreturns the extended form). The function now checks for the prefix, and maps\\?\UNC\back to\\, the same way CPython'sntpathdoes.Added a parametrized
test_sanitize_win_longpathinlib/spack/spack/test/util/path.py(pure string checks, so it runs on any platform); three of the cases fail without the change.ruff checkandruff format --checkpass on both files.Note: I found this with a static check (ruff PLE1310) and used Claude (an AI assistant) to help write the fix and test; I reviewed and ran them.