--glob patterns with a path separator never match in --full-path mode on native Windows
On native Windows (PowerShell or cmd, no MSYS involved), glob patterns that contain a path separator never match anything in --full-path mode.
Repro on fd 10.4.2, Windows 11:
mkdir C:\t\fixture\src\foo echo x > C:\t\fixture\src\foo\a.spec.ts fd --glob --full-path "/src//.spec.ts" C:\t\fixture -> no output, exit 0 fd --glob --full-path "**\src**.spec.ts" C:\t\fixture -> no output fd --glob --full-path "\src\\.spec.ts" C:\t\fixture -> no output fd --full-path "src[/\]..spec.ts$" C:\t\fixture -> matches (regex mode) The regex mode line shows the candidate paths still contain backslashes at match time, while the glob derived regex only accepts /.
Cause: in glob mode build_pattern_regex (src/main.rs) extracts the regex from globset (GlobBuilder::new(pattern).literal_separator(true).build()?.regex()), where / is the literal separator. walk.rs then matches that regex against the raw native path bytes (pat.is_match(&filesystem::osstr_to_bytes(...))). globset's own matcher normalizes \ to / in Candidate::new before matching, but that step is skipped when the extracted regex is used directly.
Possibly related: #1227, but that report is from MSYS and mixes in shell path mangling. This repro has no MSYS in the loop.
Found while debugging earendil-works/pi#6817, where the find tool inherited this via fd --glob --full-path.
Source: sharkdp/fd