Repository navigation
Conversation
Rust's standard Windows argument escaping writes `\"` for every quote in a command string, which cmd.exe does not understand: a filter driver whose command quotes an argument -- a path with spaces, or any `%f` substitution that needs them -- failed with "The filename, directory name, or volume label syntax is incorrect" before the driver ever ran. Pass the substituted command to `cmd /C` with `raw_arg` so it arrives verbatim, the way a shell command line is meant to reach cmd.exe. The Unix `sh -c` arm and the `%f` metacharacter refusal policy are unchanged. The Windows conflict-surface tests now exercise this end to end with a quoted absolute path.
Three fixtures assumed Unix and failed on the Windows CI path: - `git_import_preflight_repairs_a_database_left_by_a_killed_process` copied the repository while the database was open. Windows cannot reproduce that copy -- redb holds a byte-range lock over the open database, so every second-handle read fails with a sharing violation (OS error 33) -- so the fixture now opens the database in a child process and kills the child, which produces the same unclosed state on every platform and finally matches the test's own name. - The conflict-surface fixtures ran `clean = "cat"`, and `cat` does not exist on Windows. The byte-exact pass-through is now platform-aware: Unix keeps `cat` on stdin; Windows points `type` at the working file's absolute path (there is no stdin pass-through on Windows that preserves bytes -- `find` rewrites line endings), embedded as a TOML literal string. This needs the verbatim `cmd /C` command pass-through from the previous commit, and covers it end to end.
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.
fix(windows): native test suite — cmd.exe verbatim filter commands + portable fixtures
Three failures on the native Windows CI path, all fixed and verified on
Windows (x86_64-pc-windows-msvc, NTFS) and Linux (Ubuntu, ext4):
1. Filter driver commands never reached cmd.exe intact (production fix)
run_bounded_commandspawnedCommand::new("cmd").args(["/C", &command]).Rust's standard Windows argument escaping writes
\"for every quote inthe command string — and cmd.exe does not understand backslash-escaped
quotes. Consequence: any filter driver whose command quotes an argument
(a path with spaces, or any
%fsubstitution that needs them) failed with"The filename, directory name, or volume label syntax is incorrect" before
the driver ever ran.
Fix: pass the substituted command with
raw_argsocmd /Creceives itverbatim, the way a shell command line is meant to reach cmd.exe. The Unix
sh -carm and the%fmetacharacter refusal policy are unchanged. Theconflict-surface tests now cover this end to end with a quoted absolute
path.
2.
git_import_preflight_repairs_a_database_left_by_a_killed_processThe fixture copied the repository while the database was open — possible on
Unix (a second handle reads a live redb file), impossible on Windows:
redb holds a byte-range lock over the open database, so
fs::copyfailswith a sharing violation (OS error 33).
Fix: the fixture now opens the database in a child process and kills the
child (
child.kill()= SIGKILL / TerminateProcess), producing the sameunclosed, must-repair state on every platform — and finally matching the
test's own name. Reuses the spawn-marker-kill pattern already proven by
changes::staged_projected_change_survives_process_kill_without_partial_publication.3. Conflict-surface fixtures ran
clean = "cat"catdoes not exist on Windows, so the required filter failed for thewrong reason and both conflict tests errored out early.
Fix: the byte-exact pass-through is platform-aware — Unix keeps
catonstdin; Windows points
typeat the working file's absolute path (there isno stdin pass-through on Windows that preserves bytes:
find /V ""rewritesLF to CRLF, verified). The path is embedded as a TOML literal string and
depends on (1) for the quoted path to reach cmd.exe.
Verification
atomic-repositorysuite green.re-verified), all 18 conflict-surface tests pass, switch regression
tests pass.
cargo fmt --checkclean; clippy shows no new warnings (threepre-existing
#[cfg(windows)]sites remain, never linted by theubuntu-only clippy job).