Repository navigation
Windows support: four fixes from the windows-support branch - #50
Merged
Merged
Conversation
Windows returns junction and symlink targets with a verbatim prefix (the UNC form for network paths). Left in, it defeats every path comparison. readlink is the one place every caller goes through, and the prefix is stripped before the absolute form is normalized. Removes the Windows skip on test_readlink_with_absolute_target, which this should fix; that cannot be confirmed without a Windows run. Relates to #27.
resolve() can spell one file differently on Windows (case, 8.3 short names), so comparing resolved strings gives false negatives. Use Path.samefile() in is_same_file and, through it, is_same_files, which keeps its order-insensitive behaviour and gains an explicit length check. samefile() needs both files to exist, so a dangling link falls back to the resolved-path comparison; callers in stow/unstow/clean compare dangling links. This acts on the TODO in the is_same_file docstring. The POSIX test uses hard links as a stand-in for the Windows spellings; the case-insensitivity test only runs on Windows and has not been run there. Relates to #27.
Path.glob raises ValueError for patterns the file system rejects (some on Windows, a null byte on POSIX). Treat them like an empty result instead of crashing, in both should_ignore and the root glob cache. Not taken from the original #27 commit: testing the pattern against the source's children. That ignores a whole directory when any child matches, so "**/*.swp" would drop the folder holding a .swp file, which test_recursive_ignore_keeps_parent_and_nonmatching_files forbids. Master's parent-and-root glob already covers matching the source itself, and has_ignored_descendants handles pruning. Blank lines (#3) are already fixed on master by filtering empty patterns. Relates to #27.
This was referenced Nov 7, 2026
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.
Refs #27, #13
Summary
This re-applies the four changes from the old
windows-supportbranch ontop of current
master, one commit for each. The old branch is not changed.symlink_togetstarget_is_directory. On Windowsa directory link and a file link are different, and the wrong one does not
work. POSIX ignores the argument.
\\?\prefix.readlinkremoves it from the raw target before the pathis normalized, so later path comparisons work.
samefile().resolve()can spell one file in different ways onWindows.
is_same_filesalso checks the length, becausezip()stops at theshorter list. For a link whose target is missing, it falls back to comparing
resolved paths.
raising
ValueError.Not taken from the old branch: testing the ignore pattern against the
source's children. It would ignore a whole directory when one child matches,
and
test_recursive_ignore_keeps_parent_and_nonmatching_filesforbids that.masteralready handles blank lines (#3).Two hard links to one file now count as the same file on POSIX too.
Evidence
target_is_directorycall, the prefix strip, the hard-link comparison and the null-byte pattern.
After: they pass on Linux (154 passed, 11 skipped).
samefile()with different letter case and the prefix testsmatter on Windows. The
windows-latestjob in this PR is the first Windowsrun for them. The drive-relative
readlinktest stays skipped.Merge Danger
Door: two-way. Each change is a separate commit and can be reverted alone.
Blast Radius:
readlink,is_same_fileand ignore matching are used bystow,unstowandcleanon every platform. Thesamefile()change is theone that can change POSIX results, for hard links.