Repository navigation
test(host): pin the closed-stdout contract across every non-interactive execution shape (closes #286) - #289
Merged
Merged
Conversation
…ve execution shape (closes #286) The #286 failure (host_contract::closed_stdout_pipe... red on 0830c78: niu never exits after the stdout reader leaves and spams 'niu: line 1: Broken pipe' per failed write) is already fixed on master by the piped-stdout pump (#245/#256): one diagnostic, status 1, prompt exit. Reproduced locally for the record - the pin file below is RED on 0830c78 (3 of 4 shapes hang past the deadline) and GREEN on master. What was still unpinned after #256 were the execution shapes #286's report implies but nothing guarded: a script FILE producer loop, a stdin-script producer loop, an EXTERNAL child as the unbounded producer (the inherited-handle path), and stderr being gone too when the pump reports. All four now carry the deadline-bounded contract: exit by itself, rubash#455-shaped status 1, no raw OS broken-pipe text, exactly one diagnostic. GNU oracle (WSL bash): the same producer under 'bash | head -c 16' dies promptly via SIGPIPE with zero stderr bytes; niu's vendored adaptation keeps the prompt termination and the errno silence, spending one descriptive diagnostic plus status 1 instead of signal death - deliberate, per the rubash#455 semantics ownership note in tests/broken_stdout_pipe.rs.
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.
Closes #286.
Root cause (verified locally, RED reproduced)
#286 reported
host_contract::closed_stdout_pipe_does_not_print_broken_pipe_errorred on 0830c78: after the stdout reader leaves, niu never exits and stderr floods withniu: line 1: Broken pipe— one engine diagnostic per failed write, forever, because Windows has no SIGPIPE to kill an unbounded producer and the host had no convergence of its own (the engine's rubash#455 semantics correctly treat a closed-output write as the hitting command's failure and continue the list; on an infinite loop that degenerates into per-iteration spam).The behavior fix is already on master: the piped-stdout pump (src/piped_stdout.rs, #245/#256, commit 11c1612, which landed after 0830c78) interposes one wrapper pipe between every process stdout writer and the real downstream, and on the first failed downstream write reports ONCE and exits status 1. Reproduced the RED for the record on a detached 0830c78 worktree (same spam, 3.79s FAILED), and master is GREEN (0.7s).
What this PR adds
The
-cbuiltin-loop andyesshapes were already pinned by tests/broken_stdout_pipe.rs (#256's suite) and host_contract.rs. What nothing yet guarded were the execution shapes #286's report implies but no test covered. New tests/issue286_pipe_close_exit.rs pins all of them, deadline-bounded (a hang fails the test):niu loop.sh)niu, script on stdin)cmd /c echoper iteration — the inherited-wrapper-handle path)Contract pinned per shape: exit by itself, rubash#455-shaped status 1, no raw OS broken-pipe text ("Broken pipe" / "os error 232" / 管道正在被关闭), exactly ONE diagnostic.
GNU anchoring
WSL oracle:
bash -c 'while true; do echo x; done' | head -c 16— bash dies promptly via SIGPIPE with zero stderr bytes. niu's vendored adaptation keeps the prompt termination and the errno silence, deliberately spending one descriptive diagnostic plus status 1 instead of signal death (rubash#455 semantics ownership note in tests/broken_stdout_pipe.rs). Vendored-rubash side unchanged (#455 execute_cmd/trap semantics respected).Test evidence
cargo test --no-fail-fast --workspace --locked, RUST_TEST_THREADS=1 as pinned) run on BOTH this branch and a fresh 2a6a12a worktree: failure sets identical name-by-name in both directions — 4 failing targets (interactive 35, issue182_bashit_history_interlock 1, repl_command 1, smoke_1_3_0 2), same 33 failure names, all pre-existing (the repl: PSReadLine-style paste-chunk detection for the Windows console path #252 interactive family and the 2026-10-12 audit's known set). No new failures, issue286 target 4/4 ok.cargo fmt --check --allclean. No product code touched; test-file-only, same shape as the [bug] RETURN trap 只在 source 完成时触发,函数返回不触发(GNU bash 两者都触发) #204/Parser strips ESC (0x1B) byte immediately after opening single quote in script #200 pin PRs.Merge-order note
#284/#287 (paste/typeahead, repl.rs + typeahead_guard.rs) is landing first per plan; this PR touches only tests/issue286_pipe_close_exit.rs — no file overlap. If master moves, rebase is trivial and I'll refresh.