Repository navigation
fix(executor): TMOUT judgment for compound commands fed by raw <(...) redirects (#1141) - #1521
Merged
Merged
Conversation
…directs (rubash#1141)
Brace groups, select and loops dispatch before the simple-command
materialization gate, so a `< <(...)` redirect_in reached
bind_command_fd0_input still in raw substitution form. The binder
only recognized materialized stream paths, so the node fell through
to command_input_redirect -> loop_redirect_input, which slurps the
body untimed into FUNCTION_STDIN and clears timed_stdin: TMOUT could
never fire for the compound\x27s reads or select queries
({ read x; } < <(sleep 2; echo hi) returned rc=0 x=[hi] instead of
rc=142 x=[]; select consumed the late answer with end rc=0).
The binder now materializes the raw form itself via
process_substitution_output_bytes_timed (the same timed variant the
prepare path runs for simple commands) and binds fd 0 to the timed
process-substitution endpoint for the compound scope. The endpoint
is scope-private: no registry entry, no temp file, no offset
write-back on restore. A body that fails to materialize falls
through to the previous paths unchanged.
GNU anchors: builtins/read.def:506-519 (TMOUT arms the read alarm;
timeout returns 128+SIGALRM with the arrived partial input assigned,
read.def:528-554); execute_cmd.c:3426/3578 (select\x27s query is the
read builtin, so a timed-out select read ends the loop with
EXECUTION_FAILURE); subst.c:6362 process_substitute (the body runs
concurrently, so consumers observe real arrival times — the recorded
production schedule is the equivalent evidence).
Regression coverage: tests/issue1141_tmout_compound_redirect_regressions.rs
(11 tests: group read x2, group partial prefix, select redirect,
while/for redirect forms, no-TMOUT and prompt-data guards, plus the
previously fixed direct/pipeline/function forms as anti-regression
guards). Verified against the self-compiled GNU Bash 5.3.20 oracle:
34-case TMOUT probe matrix byte-identical except one documented
arrival==deadline boundary case; cargo test --lib 728 passed / 1
failed (pre-existing ownership environment item only); 246-case
differential 243 pass, stable failures {gl08, ms10} plus the flaky
pre-existing ps06 wait -n race (3/6 pass on identical reruns).
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.
Fixes #1141
第四波第一片:#1141 TMOUT 剩余三例(select 重定向 c22、组 read c23、组双 read c24)全部修复,同根因的 while/for 重定向形态一并对齐。
根因(一句话)
复合命令不经简单命令的 prepare 侧门,其 fd 0 上的原始
<(…)重定向到达绑定器时三条计时路径全部落空,最终被无计时的灌入路径物化并清掉计时,于是组内 read/select 永远等生产者出完数据、TMOUT 永不触发。改动范围
src/executor/command_input_scope.rs(+59 行,单文件):bind_command_fd0_input新增一臂——fd 0 的原始<(…)输入重定向直接以计时变体物化并绑到带时刻表的端点,read/select 的 TMOUT 判定由此成立;物化失败落回原路径。未动执行器核心调度,无载体字节改动。tests/issue1141_tmout_compound_redirect_regressions.rs(新增,156 行):[bug] TMOUT ignored by read and select #1141 全矩阵回归固化 11 例(三例本体 + while/for + 无 TMOUT 对照 + 及时数据防误触发守卫 + 已合形态守卫 3 条),与修复同 commit。验证数字(集成分支实测,门控配方)
cargo build --locked:通过。cargo test --locked --lib:728 passed / 1 failed,唯一失败ownership_unary_operators_check_existing_file(许可的环境项,root 环境)。cargo test --locked --test issue1141_tmout_compound_redirect_regressions:11 passed / 0 failed。残差与抖动说明
142 x=[a]),第二读不断言并在注释中注明;管线形同一脚本两边一致。wait -n状态竞态)单次 FAIL,同二进制单例 6 连跑 3 过 3 败,属既有 part_036 作业通知竞态族,与本改动面(fd 0 的<(…)绑定)无关;本片集成分支差分一轮 ps06 为 PASS,稳定失败集仍为 {gl08, ms10}。