Skip to content

fix(redirect): append funnel resolves the node's byte spelling (Refs #3372) - #3565

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/3372-append-funnel-node-key
Nov 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/3372-append-funnel-node-key

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #3372(部分修复:追加漏斗本身;同单内其余面未做,见 Owed)

修了什么

在 LC_ALL=C.UTF-8 下,a="$(printf 'x\234')"(原始字节 0x9C)和 b=x$'\u009c'(真字符 U+009C,UTF-8 为 C2 9C)折叠后是同一个串。GNU 落盘为两个文件 78 9C 和 78 C2 9C。rubash 的追加漏斗只查串键记录,被 >"$a" 写入的原始字节拼写误导,结果追加又打开了 78 9C,78 C2 9C 根本没有创建。

  • src/executor/shell_options.rs:新增 open_append_target_for(Option<&Redirect>, target),open_append_target 改为委托给它(传 None)。所有文件系统分支(Filesystem、FdAlias 回落、SyntheticProc 回落)在拿到节点时走 redirect_target_filesystem_path_for,也就是节点键记录;没有节点记录就走平凡漏斗,绝不借用串键记录。机制与 W-WORD 续跑:#3192 单引号跨度逐字段 / #3084 case 词 DQ 装框 / #3218 重定向目标字节拼写 #3368 的创建漏斗相同。
  • probe_output_redirect_append 增加节点参数,FIFO stat 和追加打开两个开口都走节点拼写。
  • 持有节点的追加调用点改为传入节点:builtin_redirects.rs(3 处,另有 probe 1 处)、external_redirects.rs(4 处)、redirection.rs(1 处)。
  • src/executor/mod.rs:订正字段注释。原注释说"无传输结果会清除串键记录",代码里并没有这个删除;改为如实描述,并注明持有节点的消费者必须读节点键映射。

删了什么

  • 上述调用点不再查串键记录。

附带:tests/d11_pipeline_squote_carrier_regressions.rs 在 master(#3511)合入时未格式化,导致 pre-commit 的 rustfmt 检查失败。本 PR 对它跑了 rustfmt,只改格式;#3531、#3554 带有同一改动,几处字节相同。

GNU 依据

  • redir.c:298 redirection_expand():每个重定向各自展开出自己的字节。
  • redir.c:702 redir_open():追加(O_WRONLY|O_CREAT|O_APPEND)原样打开这些字节。GNU 没有跨重定向共享的拼写表。

验证

回归测试 tests/issue3372_append_funnel_node_spelling.rs:6 个测试,#![cfg(unix)]。期望值是 GNU 5.3.20 留下的目录列表(名字字节 + 内容)。

环境 修前 修后
Linux(WSL 构建,同一树) 1/6 6/6

其中唯一修前就通过的一项(while … done >"$a" >>"$b")是对照。

同族 stem 在 Linux 上:cat_redirect_stream 2/2、issue1313 2/2、issue1820 3/3、issue1898 6/6、issue1964 6/6、issue2121 14/14、issue2285 7/7、issue2385 19/19、issue2759 6/6、issue3104 24/24、issue3218 2/2、issue3268_birth 12/12、issue3268_deleted_cwd 19/19 全部通过。issue1025… 为 15/16、issue518 为 3/6,修前修后失败名单相同(以 root 运行 WSL 时就有的失败)。

Windows:构建无警告;issue1964、issue518、issue2385 的失败名单修前修后逐个相同;cat_redirect_stream、issue1898、issue2285 全部通过。

Owed(#3372 仍开着)

  • 写入绑定面未修。下列形状在本 PR 后两个文件都会创建(修前只有一个),但内容仍写进了串键文件:echo B >"$a" >>"$b"(内建)、{ echo B; } >"$a" >>"$b"、f >"$a" >>"$b"、echo B >"$a" 2>>"$b" 1>&2、ls -d / >"$a" >>"$b" | cat、echo B >>"$a" >>"$b"。根因是内建/复合输出的 fd 绑定以字符串存目标(OutputTarget::Path),flush 时(redirection.rs open_flush_file)只剩串,没有节点。要修需要在绑定里携带解析后的拼写,属于结构改动,未做。
  • 理论项未做(议题要求先用探针坐实):source_type_state.rs / function_calls.rs 的预创建、external_finish.rs 的 cat 输出开口、pipeline_stages.rs 的合并追加(无节点)、path.rs 的 cd 面和 $(<file) 面。
  • type 显示面(0x9C 类名字)未做。
  • 在 rubash 里用 for f in x* 枚举字节名文件,得到的是有损名字(78 EF BF BD),所以本 PR 的验证全部在外部用 GNU 列目录,没有依赖 rubash 的 glob。这个 glob 面未立单,留作探针线索。
  • 未跑全量 83 套件账本(AGENTS 对 carrier 相关改动的要求)。

…3372)

GNU redir.c:298 redirection_expand gives every redirect its own expanded
bytes and redir.c:702 redir_open opens them verbatim, so in
`: >"$a" >>"$b"` a raw-byte x<9C> and a genuine x<U+009C> (same folded
string) land as two files. #3368 made the create funnel read the
redirect-node spelling record; the append funnel still read the
folded-string record and reopened the other redirect's spelling.

- shell_options: open_append_target_for(Option<&Redirect>, target); every
  filesystem arm resolves through the node record when a node is given
  (plain funnel otherwise, never the string-keyed record).
  probe_output_redirect_append takes the node too, for both its FIFO
  stat and its open.
- builtin_redirects / external_redirects / redirection: the append call
  sites that hold the node pass it.
- mod.rs: correct the field comment that claimed a no-transport outcome
  clears the string-keyed record (the code never removes it).

Also rustfmt tests/d11_pipeline_squote_carrier_regressions.rs, which
landed unformatted on master (#3511) and fails the pre-commit check.

Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 16, 2026 11:39
@caomengxuan666
caomengxuan666 merged commit 874ef5b into master Nov 16, 2026
8 of 11 checks passed
@caomengxuan666

Copy link
Copy Markdown
Member Author

【WIN-AGENT-AUDIT】s10 lane 第 1 轮 — 建议:PASS(按 S 波授权已 squash 合入)

head: f1bbd78 base(merge-base): 8b48c16 文件: 7 个 +189/-30
squash: 874ef5b(合入时 master tip 6267c43,合并形本地树 commit 先验过)
关联 issue: #3372(状态:open,我核过的时间:2026-11-16 19:39 CST)— 部分修复,未关单,见下「issue 口径」

机制核查:

腿(逐项给数字与名字):

  • 钉自跑:issue3372_append_funnel_node_spelling 合并形(6267c436+head)Linux 6/6(null_command / external_stdout / external_stderr / external_combined / external_append / compound_control 全 ok)。Windows 该文件是 #![cfg(unix)],编译为 0 tests,见「未跑」。
  • fail-first:base 8b48c164(PR merge-base)+ 原样钉 = 1 passed / 5 failed,红名 = {issue3372_null_command_create_then_append, issue3372_external_stdout_create_then_append, issue3372_external_stderr_create_then_append, issue3372_external_combined_append, issue3372_external_append_then_append};正文声称 1/6,一致(唯一绿的是 …_compound_create_then_append_control 对照格)。
  • lib 双边(Linux,cargo test --lib,基底 = master tip 6267c43):head 1252 passed / 0 failed / 4 ignored;base 1252 passed / 0 failed / 4 ignored;差集 ∅。
  • -D warnings:RUSTFLAGS="-D warnings" cargo check --lib --bins 干净(0 警告)。--all-targets 撞 tests/issue2642_command_v_env_regressions.rs:54 的 code: Option<i32> dead_code —— 在 base 6267c43 上逐字同样红,基线,不是本 PR 的账。
  • 卫生:rustfmt --edition 2021 --check 本 PR 7 个文件全干净;marker-lint / utf8 钩子本 PR 未触相关面,未发现新增字面量。
  • CI:红腿 3 个,逐个归因 —— Rust tests、Rust tests (macOS)、GNU regression goldens and canaries 皆仅 api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell(panic 在 src/api/consumer_tests.rs:2911),run 43561464974 实读日志确认,= 基线 issue2875。其余 8 腿 pass。
  • GNU 对照:WSL GNU 5.3.20(/usr/local/bin/bash,x86_64-pc-linux-gnu)。LC_ALL=C.UTF-8; a="$(printf 'x\234')"; b=x$'\u009c'; : >"$a" >>"$b" → GNU 落 789c 与 78c29c 两个文件;合并形 rubash 落同两名、内容空 → 一致。探针 .lane-scratch/gnu-probes.sh 3372。

F 点:无

issue 口径(重要):

未跑/VOID 的腿:

  • Windows 上跑该钉 = 0 tests(文件 #![cfg(unix)],平台面不适用);Linux 合并形已 6/6,不构成缺腿。

@caomengxuan666

Copy link
Copy Markdown
Member Author

【WIN-AGENT-AUDIT】s10 批次汇总(9 条清单全部有处置;审计+合并+关单一体 lane)

合并(4,squash,均「先审计 → 合并形本地复验 → gh pr view 实时核 head/mergeable → --squash」,未删分支):

PR squash 关联 issue 钉
#3565 874ef5b0 #3372 保持 open(PR 自述部分修复,剩余面见单) issue3372_append_funnel_node_spelling 合并形 6/6;base 1/5
#3559 e93d3dd9 #3305 closed issue3305_read_coproc_unit_scan 合并形 7/7;base 2/5
#3558 72ae8351 #3388 closed issue3388_quoted_paren_function_head 合并形 4/4;base 1/3
#3549 12fb4e61 #3457 closed issue3457_init_file_enoent_silent 合并形 6/6;base 2/4

跳过不合(4,CONFLICTING/DIRTY,对现尖 git merge-tree --write-tree rc=1):

PR 冲突文件 备注
#3564 src/builtins/exec.rs + scripts/git-hooks/pre-commit 另夹带 scripts/check-rustfmt.py(267) / check_rustfmt_test.py(324) / pre-commit 重写,与 #3316 无因果关系,消解冲突时应拆出
#3562 src/executor/pipeline_exec.rs 与 #3509 同一文件同一片区域,两者互相冲突,需队长定序
#3561 src/executor/parameter_errors.rs master 上该文件已被其他 lane 动过
#3509 src/executor/pipeline_exec.rs 外部贡献者 PR,队长已登「先走队长复核」;同上与 #3562 撞面

建议 FAIL(1,不合不关,draft 保持):

PR 阻断点
#3538 F1 note_console_ctrl_z 读窗口计数/写请求位非原子(src/builtins/kill.rs:1062/1065 vs :1098-1101),迟到 ^Z 可停掉下一条命令;F2 缺队长要求的「旧窗口结束 × 投递」确定性并发测试;F3 正文写提案 A 但该提交已被 357786de revert 到 #3567;F4 正体验证/Owed 仍是「进行中」

共同腿结论(4 条合并项实测,非推断):

  • lib 双边(Linux):每项 head 1252 passed / 0 failed / 4 ignored,base(6267c436)同 → 差集 ∅。
  • -D warnings:--lib --bins 全 0 警告;--all-targets 唯一红是 tests/issue2642_command_v_env_regressions.rs:54 的 code: Option<i32> dead_code,在 base 上逐字同样红 = 基线。
  • CI:每条 PR 的 3 条红腿(Rust tests / macOS / GNU goldens)逐条读日志都只命中 api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell(src/api/consumer_tests.rs:2911)= 基线 issue2875,无 PR 自身红格。
  • 卫生:rustfmt --edition 2021 --check 每个 PR 的改动文件均干净(cargo fmt --check 在本机 os error 206,按台账替代法逐文件跑并披露)。

阻塞项 / 给队长的两件事:

  1. feat(jobs): Windows foreground Ctrl+Z stop surface — inject_console_ctrl_z + Stopped arm (Refs #3467) #3538 的 F1/F2 修好前,[windows] Foreground Ctrl+Z needs an engine stop surface: inject_console_ctrl_z + Windows Stopped arm (companion to niubash#877) #3467 链(feat(jobs): Windows foreground Ctrl+Z stop surface — inject_console_ctrl_z + Stopped arm (Refs #3467) #3538 → feat(jobs): Windows virtual-sleep Stopped carrier — proposal A stand-down (Refs #3467) #3567)不能推进;外部 fix(windows): foreground Ctrl+Z stop surface — inject_console_ctrl_z + Windows Stopped arms (Refs #3467) #3746 仍暂缓,本轮未碰。
  2. fix(executor): wire every pipeline stage's fd 2 from the fd table on the Windows and shell-stage spawn paths (Refs #3402) #3562 / fix(executor): keep pipelines concurrent with fd-2 redirects (Refs #3516) #3509 同面(pipeline_exec.rs fd-2 准入与中继),fix(exec): rebind the exec target with GNU full_pathname (Refs #3316) #3564 的 hook/脚本夹带,fix(arith): trap set -u at GNU's read points, not a text pre-scan (Refs #3496 #3497 #3498) #3561 的 parameter_errors.rs,都需要先 rebase 到现尖再重跑第 4 节协议。
  3. #3218 残差:追加漏斗与同胞消费者仍走折叠串键(同串碰撞未除)+ type 显示面 #3372 保持 open 是有意的:追加漏斗面已落,source_type_state/function_calls 预创建、external_redirects.rs:1300、external_finish.rs:148、path.rs cd 与 $(<file)、面 3 type 显示仍未做。

证据路径(本 lane worktree D:/repo/rubash-devin-s10,均未提交、未入主树):
.lane-scratch/gnu-probes.sh(#3372 GNU 双文件)、.lane-scratch/gnu-3305-all.sh(#3305 十九格,GNU 与合并形逐字节)、.lane-scratch/gnu-3388-*.sh、.lane-scratch/gnu-3457-all.sh(#3457 五格)、.lane-scratch/linux-run.sh / fmt-check.sh(WSL Linux 构建与逐文件 fmt)。

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