Skip to content

Refs #3102 - #3136

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/3102-array-mirror-raw-byte-pairs
Nov 15, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/3102-array-mirror-raw-byte-pairs

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

现状(UNVERIFIED-BY-CAPTAIN)

  • 钉子已提交:1ecf9c8c(tests/issue3102_array_mirror_raw_byte_pairs.rs,A–E 九格,期望值逐字节取自 GNU bash 5.3.20)。
  • 修法 WIP 尚在工作树,未提交:compound_field_split_transport 合成回退分隔符由硬编码空格改为 live IFS 首字符(见 REPORT 待补)。
  • 根因:多元素数组赋值里元素带 U+E000 原始字节对时,field-split transport 找不到字段原文,退化为 synthetic U+E309 + ' ' 分隔;indexed 重分裂只在 tag 后跟 IFS 字符时才认边界,IFS=$'\n' 下空格不可见,字段粘成一个元素,typed cell 与 mirror 不一致(debug 构建在 variable_state.rs verify_typed_cells panic)。

本 PR 删除了什么

无删除(纯新增:1 个钉文件;修法为赋值臂参数化,见后续提交)。


队长复核前请勿合入。

…ic separator (Refs #3102)

Under a non-whitespace IFS the field-split transport fell back to a
synthetic U+E309 + ' ' separator when a field could not be located
verbatim (raw-byte pair U+E000+payload); the indexed re-splitter only
honors the tag before an IFS character, so the fields glued into one
element and the typed cell disagreed with its mirror
(variable_state.rs verify_typed_cells). GNU arrayfunc.c:557
expand_compound_array_assignment / subst.c:13219
expand_word_list_internal split exactly once on the live IFS.
@caomengxuan666

Copy link
Copy Markdown
Member Author

【WIN-AGENT-AUDIT】

PR #3136 第1轮 — 建议:PASS
head: cddf4fb(含两 commit:1ecf9c8c 钉 + cddf4fb 修法) base(merge-base): b8af233 文件: 3 个 +173/-13
关联 issue: #3102(状态:open,我核过的时间:本地当前;本 PR 无先验评论)

机制核查:

  • 根因正确:compound_field_split_transport 对无法逐字定位的字段(IFS_GLUE 改写/原始字节对 U+E000+payload)回退合成 tag+空格分隔,但 indexed 重分裂器只认 tag+IFS字符边界——IFS=$'\n' 下空格不可见→字段粘成一元、typed cell 与 mirror 分裂(debug 构建 verify_typed_cells panic)。修复把分隔符参数化为 live IFS 首字符(ifs_first_char_separator),6 个调用点统一传入——机制级修复,非症状补丁。GNU 锚点:arrayfunc.c:557 expand_compound_array_assignment / arrayfunc.c:610 expand_words_no_vars(每词按 live IFS 恰分裂一次)、arrayfunc.c:627-635(assoc 跳分裂)、subst.c:13219(空字段不贡献元素)。
  • 注意:PR 正文写「修法 WIP 尚在工作树未提交」——已过时,head 第二个 commit cddf4fb 即修法本体,正文待作者更新(不影响判词)。
  • 无关改动:无。

腿(逐项):

  • 钉自跑:issue3102_array_mirror_raw_byte_pairs 为 #![cfg(unix)]——Windows 本机 0 tests;head 的 Linux CI「Rust tests」全绿,钉 9 格在 Linux 实跑通过。
  • fail-first(Windows 等价探针,钉脚本改 builtin printf + winuxcmd od):base b8af233 → A(x1f)/A4(x1d)/A5(x1e) 格 n=1 字段粘连、mirror 含 ee 8c 89(U+E309)+空格垃圾字节、declare -a a=([0]=$'x\037y\' $\'z\037w') 损坏——正是 issue 描述的 mirror/typed 分裂;head → n=2、declare -a a=([0]=$'x\037y' [1]=$'z\037w') 与 GNU 逐字节一致。修复面在 Windows 可分辨,fail-first 有效。
  • lib 双边:head 失败名集 {issue2084_session_end_restores_host_process_state} / base 同集 / 差集 ∅。
  • -D warnings:lib check 干净 0 警告。
  • 卫生:rustfmt --check 三文件 FMT-OK;marker-lint OK(117 consts);utf8-boundary clean。
  • CI:全绿(API ledger / compat CLI / cross-target×2 / GNU goldens / Rust tests / macOS / shell tests / Windows compile / niubash build 均 pass)。
  • GNU 对照:WSL GNU bash 5.3.20(1)。钉内嵌脚本逐字节复跑,输出与钉 EXPECTED 常量完全一致(9 格:local -a fn×5、top-level、COMPREPLY、单元素、IFS=colon)。
  • Windows 残差观察(非本 PR 账):\x1c 字面字节在 Windows 两侧均被吞(A2/A3 格 78 79 vs GNU 78 1c 79)——\x1c 即 IFS_GLUE 载体字节,Windows 传输路径另有解释;Linux 上钉该两格绿(CI 实证)。钉显式 cfg(unix),建议另案追踪 Windows 载体面,不阻塞本 PR。

F 点:无。

续作记录:未动代码。

未跑/VOID 的腿:

  • 钉 stem 本地 0 tests(cfg unix);已由 Linux CI 绿 + Windows 等价探针(base 粘连红 / head 逐字节对齐 GNU)覆盖。

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