Skip to content

fix(executor): fd-state walk rejections carry the compound class prefix (#3406) - #3424

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix-3406-arith-fd0-line
Nov 12, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix-3406-arith-fd0-line

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

What

The executor's fd-state validation walk rendered its redirect rejections with the plain funnel line prefix, while the post-dispatch redirect paths have carried the class convention since #3183 (compound_redirect_error_prefix: ambient line for plain compounds, the node's completion line for cm_arith / cm_cond, the command's own line otherwise). GNU runs do_redirections before the dispatch stamps any line (execute_cmd.c:854), and error_prolog reads the global line_number — except cm_arith / cm_cond, whose executing_line_number substitutes the node's own line (execute_cmd.c:412-428), which for a command completed by a continuation is its completion line.

So (( x = 1 \ + newline + )) < /nonexistent-xyz/file reported the failing fd-0 open at line 1; GNU reports line 2.

Change

Thread compound_redirect_error_prefix(cmd) into the walk's three rendering points in src/executor/redirection.rs:

  • reject_redirect_at — the hub for the fd-0 input probe, ambiguous redirects, and the per-entry text rejections;
  • reject_with_dup_bad_fd's second line (GNU's redirection_error for the same entry);
  • the walk's nounset unbound-target write (a redirection_expand failure at the same do_redirections moment).

Simple commands are unaffected (the convention returns the plain prefix for them). The apply funnel's writers and the prefix-stripping identification helpers keep their existing prefix contracts — audited, deliberately untouched.

Tests

New pin tests/issue3406_arith_fd0_redirect_line.rs (GNU bash 5.3.20 expectations, byte-exact rc/stdout/stderr):

  • fail-first: the arith completion-line cells — plain, inside a function body (line 3), inside a subshell, after an assignment sibling;
  • controls: the output-redirect face, the if/brace-group ambient faces, the one-line arith face, a simple command's multi-line output face.

Verification legs (box/old-server, per-stem results) are reported on the issue thread as they land.

Deletions

None — the change only re-routes three prefix expressions and adds the pin.

Fixes #3406

…ix (#3406)

GNU runs do_redirections before the dispatch stamps any line
(execute_cmd.c:854), and error_prolog reads the global line_number -
except cm_arith / cm_cond, whose executing_line_number substitutes
the node's own line (execute_cmd.c:412-428), which for a command
completed by a continuation is its completion line. rubash#3183
locked that convention for the post-dispatch redirect paths
(compound_redirect_error_prefix), but the fd-state validation walk
still rendered its rejections with the plain funnel prefix, so
(( x = 1 \
)) < /nonexistent
reported the failing fd-0 open at line 1 where GNU reports line 2.

Thread compound_redirect_error_prefix into the walk's three
rendering points: reject_redirect_at (the hub for the input probe,
ambiguous redirects and the per-entry text rejections),
reject_with_dup_bad_fd's second line, and the walk's nounset
unbound-target write. Simple commands are unaffected (the convention
returns the plain prefix for them); the apply funnel's writers and
the prefix-stripping identification helpers keep their existing
prefix contracts.

Regression pin tests/issue3406_arith_fd0_redirect_line.rs: the
arith completion-line cells (plain, in a function body, in a
subshell, after an assignment sibling) fail first; the output face,
the if/brace ambient faces and the one-line faces are controls.

Refs #3406
@caomengxuan666

Copy link
Copy Markdown
Member Author

队长复核:FAIL(返工在钉,不在产品)

复核卷宗:~/workspace/review-3424/CAPTAIN-VERIFY.md。头 88d92ce0,交集 ∅(分叉点 = 现 master 尖 f6e8c674)。

产品码是对的,钉有一格期望写错了:

  • d11(x=1 之后两行 (( )),完成行是 3 行)钉期望 case.sh: line 2:,但 head 实际报 line 3,复核以 GNU 5.3.20 oracle 对逐字节同一脚本亲测也是 line 3。车道疑似沿用 d01 的 line 2、未计 sibling 占行。更关键的是倒置实证:d11 在 base 上 pass(base 旧行为报 line 2 = 钉的错误期望),在 head 上 fail——按现写法 d11 测的是旧行为。
  • 返工:只改钉,不动产品。 tests/issue3406_arith_fd0_redirect_line.rs d11 期望 line 2: → line 3:,改后重跑钉腿 9/9(head)即可;修正后期望下 base 记账为 d01/d08/d10/d11 四格红、5 格对照绿。

其余腿全绿(box 实跑,头 88d92ce0):

  • 钉双边:head 8/9(仅 d11 错期望),base 6/9(红的恰为 d01/d08/d10 三格真 fail-first);lib 双边 1246 passed / 0 failed / 4 ignored,失败名集恒等(皆空)。
  • 三方探针 19 格:head vs GNU 17 格逐字节一致;base 10 格分歧中本 PR 治愈 8 格(d01/d08/d10/d11 行、ambiguous、dup bad fd、nounset 行、arith 输入+输出同令)。
  • fmt、UTF-8 全树卫生、RUSTFLAGS="-D warnings" 全靶重查(1505 次 rustc 调用、0 error)皆过。
  • CI 10 pass + 1 skipping;但新钉 stem 在 CI 里从未跑过(Rust tests 作业只跑精选 nextest 表,ci.yml 无任何作业引用该 stem)——新钉的唯一执行证据是本复核的腿。

Owed(既存分歧,非本 PR 引入、亦未修复,另案):

  • D03:[[ ]] 反斜杠续行输入面,GNU 报 line 1(起始行),rubash base/head 均报 line 2(完成行约定对真换行形是对的,对续行合并形是错的;根因在 parser 侧 cond 节点行记录)。
  • x05:set -u 下重定向目标未绑定,GNU 打印诊断后中止脚本(rc=1),rubash 打印同一行诊断后继续执行(rc=0);行号已对(base 2 → head 3 = GNU),控制流仍错。

合入条件: d11 修正 + 钉 9/9 重跑确认;合入正文按队长 merge-body(含标准「本 PR 删除了什么」节;PR 正文现为英文 ## Deletions — None,合入时须补标准节)。

caomengxuan666 and others added 2 commits November 12, 2026 12:52
The d11 script is x=1 (line 1) + (( y = 2 \ (line 2) + )) < BAD
(line 3), so the completion line is 3. GNU bash 5.3.20 reports
'case.sh: line 3:' for the identical script; the product already
matches GNU — the pin expectation was wrong (carried over d01's
line 2). Pin-only change; no product code touched.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 12, 2026 14:37
@caomengxuan666
caomengxuan666 merged commit c28a9dd into master Nov 12, 2026
11 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 12, 2026
… (#3436)

ci(rust): run every regression-pin stem via dynamic census (Refs #3430)

## 根因

rust 作业只跑手写精选 `--test` 表(lib、marker goldens 与 8 个点名钉),其余 1367 个 `tests/issue*.rs` 钉 stem 从未在 CI 里执行,CI 全绿也不能证明新钉跑过——PR #3424 的 issue3406 stem 在 10 pass + 1 skipping 的绿 CI 下执行了 0 次(作业日志全文 0 处 `issue3406`),唯一执行证据是复核的 box 腿。

## 改动

- 新脚本 `scripts/ci-run-pin-stems.sh`:运行时从树里枚举 `tests/issue*.rs`(裸头树 1375 个,排除 90 个后跑 1285 个;合入树 1380 个,排除 90 个后跑 1290 个——update-branch 后又添 5 根新钉 stem:issue3324/issue3329/issue3354/issue3406/issue3425),以单次 `cargo nextest run --profile ci --no-fail-fast` 全跑;新钉默认覆盖。
- 新文件 `scripts/ci-pin-exclusions.txt`:唯一的出口——逐条说明理由的排除项,共 90 项(2 根 J1 + 87 根首跑红茎 + 1 根二轮时序抖动茎)。脚本遇过期排除项(stem 已改名/删除)即报错退出,文件须跟踪树。修法落单时在同一 PR 里删对应行,stem 即默认跑。
- `ci.yml` rust 作业新增最后一步 `Run all regression pin stems`(跑该脚本);作业超时 30 → 60 分钟(全量钉编译+跑在全新 runner 上 30 分钟不够)。既有点名步全部保留(各有硬门注释),新步是普查门。

排除项(90 项,逐茎理由见文件内注释与工作区 census/triage-table.md):
- `issue2769_death_notice_line_stamp_regressions`(#2769:EOF 死亡通知投递竞态)
- `issue2777_stopped_job_state_regressions`(#2777:kill 后 wait-status 读回 127/147/148 而非 137)
- 其余 88 项为首跑 87 根红茎 + 二轮时序抖动 1 根(按失败签名类:PRODUCT 52、TIMING 16、ENV 8、MISMATCH 6、PINS-FIRST 4、PRODUCT/TIMING 1、FIXTURE 1)。

两根 J1 的修法落单时,须在同一 PR 里删掉对应排除行,stem 即默认跑。

## 本 PR 删除了什么

无删除:只新增两个脚本文件与一个 CI 步骤、改一行超时数字;无产品代码改动、无文件删除、无公开 API 删除、无行为删除。

## 验证

- 脚本逻辑以 stub `cargo` 本地验证:枚举 1375 个 stem、90 项排除项各行仅出现在 EXCLUDED 行、过期排除项路径 rc=2 且报错准确(已还原);`bash -n` 通过;`ci.yml` 经 PyYAML 解析通过(rust 超时 60、新步为 rust 作业最后一步)。
- 真凭据以本 PR 的 CI 代为准:rust 作业的 `Run all regression pin stems` 步须完整跑完并在日志里打出 `pin stems to run: 1290`。首跑若有其他钉先行红茎,须按日志逐根裁断后补进排除表再推(本 PR 不预设更多排除项)。

## 普查结果(已跑完三轮,终代全绿)

- 第一轮 run 43229859742:1373 茎 / 9063 测试,8780 通过 / 283 失败 / 5 跳过;87 根红茎,283 个测试。逐根裁断后 87 根全部进排除表(每根一行理由:issue 号 + 状态 + 失败测试数 + 最后触碰类 + 失败签名类 + 尚欠裁断)。
- 第二轮 run 43234272221:1287 茎 / 8311 测试,8309 通过 / 2 失败 / 4 跳过;仅剩 `issue2836_emulated_cat_job_control_regressions` 2 个测试失败——该茎在第一轮 3 个测试全绿(2.5–3.8s),同一份产品代码第二轮 2 红,并行负载下 PTY 时序抖动,已按 TIMING 类进排除表。
- 第三轮 run 43236628825:1286 茎 / 8308 测试,8308 通过(1 leaky,4 skipped),0 失败;全部 10 项检查通过。
- 排除表现 90 项(2 J1 + 87 + 1)。按失败签名类:PRODUCT 52、TIMING 16、ENV 8、MISMATCH 6、PINS-FIRST 4、PRODUCT/TIMING 1、FIXTURE 1。
- 头条:87 根首跑红茎里仅 4 根指向 OPEN issue(#2634、#2697、#2906、#3046,均为钉先行),其余 83 根指向已关闭 issue——普查翻出的是一大片已知红基底(过期钉 / 回归 / 环境形),须另排队长裁断波(Linux 侧串行重跑逐根分流:过期钉重钉 / 真回归修 / 环境形标注)再逐根删排除项。本 PR 只交付门 + 可见的裁断记录,不宣称产品已绿。逐茎裁断表与两轮完整日志见工作区 REPORT.md §5–§6 与 census/。

Refs #3430
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.

[bug] (( )) fd-0 redirect failure reports the command's first line; GNU reports its completion line

1 participant