Repository navigation
fix(fs_win): api_path restores the root separator on bare-drive landings - #1871
Merged
Merged
Conversation
… drive
After the '.' collapse and tail truncation, a dot-segment landing on
a drive root ('C:\.', or '.' / '.\.' joined against a root cwd) came
out as the bare drive, and api_path emitted the invalid \\?\C: —
every shared-layer consumer (stat/find/touch/pathchk, fmt/fold/paste
via file_meta, ...) failed with ERROR_INVALID_PARAMETER where GNU
stats the root. A bare-drive result now regains its root separator
and spells \\?\C:\. Refs #1869.
Member
Author
|
CAPTAIN-VERIFY — merging. Reviewed head
|
This was referenced Nov 25, 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 #1869 — UNVERIFIED-BY-CAPTAIN (code-only lane delivery; captain review pending)
Defect
fs_win::imp::api_pathcollapses.components lexically and then trims a trailing\.. When the operand lands exactly on a drive root through a dot segment, the trim shaves the root down to the bare drive:C:\, operand.→ join spellsC:\.→ trimmed toC:C:\.→ trimmed toC:C:\, operand.\.→\.collapse leavesC:\.→ trimmed toC:The result is emitted as
\\?\C:, which is not a valid path — every consumer of the shared layer then fails withERROR_INVALID_PARAMETERwhere GNU stats the root. Host baseline (X299, recorded in #1869): stat dot-segment shapes all "Invalid argument", find/touch DEFECT, pathchk single-shape DEFECT, fmt/fold/paste error-class DEFECT; du/ls OK (ls carries its own fold, #1863 — untouched here).Fix (single landing point, shared layer)
In
api_path(rust2/crates/winux-cmds/src/fs_win.rs), after the collapse + tail truncation: if the result is exactly a bare drive (C:form), restore the root separator so it emits\\?\C:\, never\\?\C:. One shared-layer fix; beneficiaries: stat/pathchk/ln/rm/touch/tee/du/find/glob directly, fmt/fold/paste viafile_meta, cp's symlink-creation face. ls'slex_collapseis not touched; the S4/S5 verbatim..faces are out of scope.Pins (fail-first, two-phase on CI)
The fix lives in the
cfg(windows)imp, which cannot execute on the lane's Linux host (no mingw linker locally; the windows-gnu target check-compiles the new code clean). Fail-first therefore runs on this PR'srust-testsjob (windows-2025) in two phases:7259b32): three discriminating pins must go red, the guard pin green —issue1869_root_cwd_dot_operand(cwdC:\,.)issue1869_drive_root_dot_suffix(C:\.)issue1869_root_cwd_dot_backslash_dot(cwdC:\,.\.)issue1869_drive_root_guards(C:\; non-root cwd.; root cwd./x)Phase results (executed,
rust-testsjob):left: "\\\\?\\C:"vsright: "\\\\?\\C:\\"; the guard pin passed. No other failures.issue1869_*pins green, delta vs phase 1 is exactly the three pins flipping.cargo check --target x86_64-pc-windows-gnu -p winux-cmds --testscompiles thecfg(windows)imp and the pins clean;cargo fmt --checkshows no diff infs_win.rs. The pins were not executed locally (no mingw linker on the lane host) — execution evidence is the CI runs above, not a local run.rust-tests.Owed verification (explicit debt)
X299 is down. The post-fix host L4 matrix — stat/find/touch/pathchk/fmt/fold/paste re-run against the recorded DEFECT baseline — has not run and is owed after X299 recovers. CI
rust-testsgreen is the only execution evidence in this PR; nothing here claims host verification.What this PR deletes / net lines
rust2/crates/winux-cmds/src/fs_win.rs): pins +42, fix +9 (guard + comment). Production-code delta is the +9.