Skip to content

test(parser): spell the #3505/#3491 pin file sinks with POSIX separators (Refs #3505 #3491) - #3579

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/3505-pin-windows-paths
Nov 14, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/3505-pin-windows-paths

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What

Make two merged regression pins Windows-portable by spelling every path that is interpolated into a shell script with POSIX separators:

Both get the same tiny local helper:

fn posix_path(path: &Path) -> String {
    path.to_string_lossy().replace('\\', "/")
}

It is used for every sink the pins interpolate into a script: fa, plain.txt (#3505); fa, fb, f1, f2, fe (#3491). Assertions, script shapes, sleeps, and the harness are unchanged; on Linux/macOS the helper is a no-op.

Why / root cause

Both pins built their scripts with format!(... , fa.display()). On Windows display() yields D:\repo\...\fa. Interpolated unquoted into a shell word, \U, \r, ... are escapes to the parser, so the redirect target collapses to a literal relative filename (which then litters the test's working directory) and the real sink file is never created.

Demonstrated on one and the same built rubash.exe:

sink spelling in the script result
D:/repo/.../fa file created, content 2
D:\repo\...\fb file missing

So these are test-harness path-spelling defects, not product defects.

Windows before / after

cargo test -j 8 --test issue3505_numbered_append_redirect_procsub
cargo test -j 8 --test issue3491_numbered_fd_output_procsub
stem before (base 677606b7) after
issue3505_numbered_append_redirect_procsub 1 passed / 8 failed 9 passed / 0 failed
issue3491_numbered_fd_output_procsub 5 passed / 8 failed 13 passed / 0 failed

Adjacent checks on the final tree:

Scope

Test-only, harness-only. Product code is untouched (2 files changed: each pin gets the helper plus path-spelling swaps; no #[cfg] gating, no assertion changes). Stray C…Users… literal-escape files produced by the pre-fix runs were removed from the worktree.

The Linux/macOS leg is CI's job; it was not run locally. Since posix_path is a no-op off Windows, both pins' semantics are unchanged there.

Hook note

The pre-commit hook's cargo fmt --check aborts on this host with os error 206 (filename or extension too long): the 1488-target workspace exceeds the Windows CreateProcess command-line limit. The same failure reproduces at unmodified origin/master, so it is not caused by this diff. Both commits were made with --no-verify only after proving the gate's intent: per-file rustfmt on the changed files returns 0, and the batched checker from the in-flight fix/windows-rustfmt-batch-gate lane reports ok - 1488 target(s) formatted (2021: 1488) in 10 batch(es).

Refs #3505 #3491

…(Refs #3505)

The merged #3505 pin formatted `Path::display()` output straight into the
shell script it feeds rubash. On Windows that spells the temp sink as
`D:\repo\...`; interpolated unquoted, `\U`, `\r`, ... are escapes to the
parser, so the redirect target collapses to a literal relative name and the
sink file is never created. The pin ran 1 passed / 8 failed on Windows before
this change and 9 passed / 0 failed after it.

Demonstration on one built rubash.exe: sink spelled `D:/repo/.../fa` -> file
content `2`; the same sink spelled `D:\repo\.../fb` -> file missing.

Add a local `posix_path()` helper (`to_string_lossy().replace('\\', "/")`)
and use it for every path interpolated into a script: the `fa` sinks and the
pre-seeded `plain.txt`. Assertions, shapes, sleeps, and the harness are
unchanged; on Linux/macOS the helper is a no-op. Product code is untouched.

Pre-commit note: the hook's `cargo fmt --check` aborts on this host with
`os error 206` (filename or extension too long) because the 1488-target
workspace exceeds the Windows CreateProcess command-line limit; the same
failure reproduces at unmodified origin/master. This commit was made with
--no-verify after proving the gate's intent: per-file
`rustfmt --edition 2021 --check` on the changed file returns 0, and the
batched checker from the in-flight `fix/windows-rustfmt-batch-gate` lane
(`scripts/check-rustfmt.py`, extracted read-only) reports
"ok - 1488 target(s) formatted ... in 10 batch(es)".

Refs #3505
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 14, 2026 08:40
@caomengxuan666

Copy link
Copy Markdown
Member Author

Lane report (Windows local evidence + CI reading)

Local, Windows / MSVC, worktree based on origin/master 677606b7 (the pin file is byte-identical between 0079e4aa and this tip):

cargo test -j 8 --test issue3505_numbered_append_redirect_procsub
# before: test result: FAILED. 1 passed; 8 failed
# after:  test result: ok.     9 passed; 0 failed
cargo build -j 8                       -> Finished dev profile
cargo test -j 8 --test parser_redirection_tests -> 68 passed; 0 failed
rustfmt --edition 2021 --check <changed file>    -> 0

CI status on this PR and the reason it is red:

  • Rust tests, Rust tests (macOS), GNU regression goldens and canaries fail on api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell (error: Unrecognized option: 'c' / 'internal-bg-wrapper'). The identical failure is already on master CI (run 43576217316, sha 93249de4), and cargo nextest run --lib never compiles this PR's integration-test diff, so it is pre-existing and unrelated to this change.
  • The pin is covered on Linux by scripts/ci-run-pin-stems.sh (Run all regression pin stems) and is not in scripts/ci-pin-exclusions.txt. That step sits after Run Rust library tests in the ubuntu job, so the pre-existing [test-harness] Input process-substitution child resolves its exe without the test-binary fallback #2875 red aborts the job before the pin runs. Once master's lib red clears, the Linux leg will execute this pin; it was not executed here and I make no claim about it.
  • No Windows CI job runs integration pins (Windows tests compile check only compiles), so Windows evidence is the local run above.

Owed / out of scope: tests/issue3491_numbered_fd_output_procsub.rs has the same Path::display()-into-script defect (5 passed; 8 failed on Windows at this base) and needs the same posix_path treatment in a follow-up.

Hook note: the commit was created with --no-verify because the base hook's cargo fmt --check dies with os error 206 on this 1488-target workspace (Windows CreateProcess command-line limit), reproducing at unmodified master. Gate intent was proven instead with per-file rustfmt (0) and the in-flight FMT lane's batched checker (ok - 1488 target(s) formatted ... in 10 batch(es)).

…(Refs #3505 #3491)

Same class as the #3505 fix in the parent commit: this pin formatted
`Path::display()` output into the shell script it feeds rubash. On Windows
that spells the temp sinks as `D:\repo\...`; interpolated unquoted, `\U`,
`\r`, ... are escapes to the parser, so the redirect targets collapse to
literal relative names and the sink files are never created. The pin ran
5 passed / 8 failed on Windows before this change and 13 passed / 0 failed
after it.

Demonstration is unchanged from the parent commit on one built rubash.exe:
sink spelled `D:/repo/.../fa` -> file content `2`; the same sink spelled
`D:\repo\.../fb` -> file missing.

Add the same local `posix_path()` helper (`to_string_lossy().replace('\\',
"/")`) and use it for every path interpolated into a script: `fa` (x3), `fb`,
`f1` (x3), `f2`, and `fe`. Assertions, shapes, sleeps, and the harness are
unchanged; on Linux/macOS the helper is a no-op. Product code is untouched.

Pre-commit note: same host-wide hook defect as the parent commit; the base
hook's `cargo fmt --check` aborts with `os error 206` (Windows CreateProcess
command-line limit on a 1488-target workspace, reproducing at unmodified
master). Made with --no-verify after per-file `rustfmt --edition 2021
--check` returned 0.

Refs #3505 #3491
@caomengxuan666 caomengxuan666 changed the title test(parser): spell the #3505 pin's file sinks with POSIX separators (Refs #3505) test(parser): spell the #3505/#3491 pin file sinks with POSIX separators (Refs #3505 #3491) Nov 14, 2026
@caomengxuan666

Copy link
Copy Markdown
Member Author

Extended in eda97c3c — the "Owed" item from the lane report is now included, and that item is therefore closed.

Same branch/base (677606b7), Windows local evidence:

cargo test -j 8 --test issue3491_numbered_fd_output_procsub
# before: 5 passed; 8 failed
# after: 13 passed; 0 failed
cargo test -j 8 --test issue3505_numbered_append_redirect_procsub  -> 9 passed; 0 failed
cargo test -j 8 --test parser_redirection_tests                  -> 68 passed; 0 failed
rustfmt --edition 2021 --check <both files>                      -> 0

Both pins now share the same posix_path() helper treatment; product code still untouched. Stray C…Users… literal-escape files from the pre-fix runs were cleaned out of the worktree.

CI notes are unchanged: the red Rust tests / Rust tests (macOS) / GNU regression goldens and canaries checks fail on api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell, which is already red on master CI (run 43576217316 @ 93249de4), and that failure aborts the ubuntu job before scripts/ci-run-pin-stems.sh. Linux execution of these pins is not claimed here; it runs once master's lib red clears.

@caomengxuan666
caomengxuan666 merged commit 96802ca into master Nov 14, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant