fix: normalize path separators for --full-path glob matches on Windows - #2089
Open
petrroll wants to merge 1 commit into
Open
fix: normalize path separators for --full-path glob matches on Windows#2089petrroll wants to merge 1 commit into
petrroll wants to merge 1 commit into
Conversation
In glob mode the search regex is taken straight out of globset, which
always emits `/` as the separator, both for literals (`\` in a pattern is
parsed as `Token::Literal('/')` on Windows) and for the generated
`[^/]`, `(?:/?|.*/)`, `/.*` constructs. globset's own matcher completes
that contract by normalizing the candidate in `Candidate::new`, but fd
uses the extracted regex directly, so with --full-path the pattern was
`/`-separated while the candidate was a native Windows path and nothing
ever matched.
Normalize the candidate the same way globset does, but only when it can
matter: --glob together with --full-path. --regex overrides --glob, so
native-separator regexes keep seeing unmodified paths.
See sharkdp#2067.
petrroll
force-pushed
the
fix/windows-full-path-globs
branch
from
August 4, 2026 22:20
48c2e3c to
da014e7
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.
In glob mode the search regex is taken straight out of globset, which always emits
/as the separator, both for literals (\in a pattern is parsed asToken::Literal('/')on Windows) and for the generated[^/],(?:/?|.*/),/.*constructs. globset's own matcher completes that contract by normalizing the candidate inCandidate::new, but fd uses the extracted regex directly, so with --full-path the pattern was/-separated while the candidate was a native Windows path and nothing ever matched.Normalize the candidate the same way globset does, but only when it can matter: --glob together with --full-path. --regex overrides --glob, so native-separator regexes keep seeing unmodified paths.
See #2067.
Alternative to another (also good!) approach of #2074