Repository navigation
fix(executor): drain signals while waiting for foreground children - #3367
Conversation
Foreground waits blocked until the child ended, so a terminating signal was only consumed at the command-end boundary. Waits are now sliced (10 ms try_wait) with mailbox draining, so the signal is consumed mid-wait and the shell dies by the signal. Refs unixwin#3284 Regression pin: tests/issue3284_engine_wait_termsig_regressions.rs (9 tests; fail-first 5 failed on the unpatched tree, 8 pass after, 1 still fails: term-comsub dies at 5.02 s instead of promptly). Adjacent signal families green. The comsub face needs a two-step lane (drain for the comsub clone + pass termsig_death_pending back to the parent) and is left as a residual. Owed: comsub timing residual; exec simulation face has no drain; interactive job-control waits not drained; read builtin blocked-read face; procsub face unprobed; issue1990_1991 3 failures are pre-existing.
|
Thanks for the PR. This is queued for captain review — collaborator PRs are reviewed by the captain before merge; noted as partial (Refs #3284, comsub face left as a residual for follow-up). CI at intake: all checks green. No action needed unless the review asks for changes. |
|
Captain review: PASS, with mandatory pre-merge conditions below. Full dossier: What the review verified (Simular box, plain cargo route, per-stem verdicts):
Residual delimitation (dossier §6) is now filed as #3401, assigned to you: face 1 comsub clone drain, face 2 blocking Pre-merge conditions (all required):
This PR must not close #3284. Once it merges, the captain will close #3284 manually with a pointer to #3401 and to the dossier. |
Captain takeover (user order 2026-11-12): apply PR unixwin#3367 review condition 1. The term-comsub cell stays red because the comsub clone layer never consumes the termsig mailbox (residual unixwin#3401; captain review dossier section 6, face 1), so gate it with #[ignore] to keep a live red cell off master; the gate comes off with the unixwin#3401 fix. No product code and no other cell touched.
Refs #3284
What was fixed
Foreground waits blocked until the child ended, so a terminating signal was only consumed at the command-end boundary instead of mid-wait. Waits are now sliced (10 ms
try_wait) with mailbox draining (observe_signals_while_blocked), so the signal is consumed while waiting and the shell dies by the signal (GNUjobs.c:3064 wait_for+quit.h:53 CHECK_TERMSIG,sig.c:650 kill_shell).What was NOT fixed (this PR is partial — hence Refs, not Fixes)
The command-substitution face is still red:
x=$(/usr/bin/sleep 5)with TERM to$$dies at 5.02 s instead of promptly. The comsub body runs in an in-process clone, and the flat-layer guard (subshell_depth > 0 && shell_pid == process::id(), #2236) stops the clone's wait from draining. Opening the guard directly would break the death direction (the clone would record the death and the parent would survive with 143). The correct lane is two steps — drain for the comsub clone only (new flag, not the shared guard) plus passingtermsig_death_pendingback to the parent — and is left as a residual for a follow-up.What was deleted
Nothing. No files, features, or tests were removed.
Verification (all run, per-item counts)
tests/issue3284_engine_wait_termsig_regressions.rs: 8 passed / 1 failed (9 tests). Fail-first on the unpatched tree: 5 failed (term-ext, hup-ext, term-pipe, term-comsub, term-merged — all ~5.02–5.20 s), 3 passed. After the fix onlyterm-comsubfails (5.02 s).issue2346_termsig_death_regressions11/11,signal_trap_coverage_regressions7/7,issue1035_1036_signal_table_regressions9/9,issue2236_nested_signal_death_regressions9/9,issue2353_ancestor_lane_termsig_regressions13/13.issue1990_1991_signal_job_regressions: 3 passed / 3 failed — reproduced identically on the unpatched tree (pre-existing, unrelated).cargo build -j 2clean,cargo fmt --checkclean.src/lexer/continuation.rsuntouched.Owed
run_external_exec_with_stdio) has no drain.readbuiltin blocked-read face (GNU 0.05 s vs rubash ~2.01 s) — a different face, unprobed.