Repository navigation
fix(redirect): append funnel resolves the node's byte spelling (Refs #3372) - #3565
Conversation
…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>
|
【WIN-AGENT-AUDIT】s10 lane 第 1 轮 — 建议:PASS(按 S 波授权已 squash 合入) head: f1bbd78 base(merge-base): 8b48c16 文件: 7 个 +189/-30 机制核查:
腿(逐项给数字与名字):
F 点:无 issue 口径(重要):
未跑/VOID 的腿:
|
|
【WIN-AGENT-AUDIT】s10 批次汇总(9 条清单全部有处置;审计+合并+关单一体 lane) 合并(4,squash,均「先审计 → 合并形本地复验 →
跳过不合(4,CONFLICTING/DIRTY,对现尖
建议 FAIL(1,不合不关,draft 保持):
共同腿结论(4 条合并项实测,非推断):
阻塞项 / 给队长的两件事:
证据路径(本 lane worktree |
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 留下的目录列表(名字字节 + 内容)。其中唯一修前就通过的一项(
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 仍开着)
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 类名字)未做。for f in x*枚举字节名文件,得到的是有损名字(78 EF BF BD),所以本 PR 的验证全部在外部用 GNU 列目录,没有依赖 rubash 的 glob。这个 glob 面未立单,留作探针线索。