Skip to content

docs(hygiene): #849 注释/坐标漂移清扫 + #768 README byte-identical 措辞(closes #849 #716 #768 #767) - #865

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/hygiene-849
Oct 19, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/hygiene-849

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

卫生打包票,四票一 PR,纯注释/docs,零行为变更。

逐票状态

#849 注释/坐标漂移清扫(rubash 侧三项,本 PR 落地)

  1. pipeline_exec.rs(wc 快路两处注释):引用 debug_assert!(!contains(CTLESC)) postcondition (locale.rs:545)——该断言随 fix(#824): decode-boundary leak asserts fired on user-literal marker text (HD1 in declare -p, guard in xtrace) #838 整体移除(输出侧 assert 会对良构用户字面标记文本误发,marker debug_assert family: user-literal text panics debug builds at two more decode boundaries (HD1 in declare -p; PARAM_WORD_BACKSLASH_GUARD in xtrace) #824),行号在删除前就已漂移。禁止 decode 的结论本身成立:payload 控制字节(如 0x11)会被当作 CTLESC 载体吞掉下一字符,fix(#824): decode-boundary leak asserts fired on user-literal marker text (HD1 in declare -p, guard in xtrace) #838 之后损坏是静默的——注释改为陈述该真实机制,不再声称有任何断言会触发。
  2. glob.rs 文档 + tests/issue832_ 头注释*:两处引用判定注释原文("If the word isn't an assignment and contains an unquoted pattern matching character, then glob it")却标注 subst.c:12601(函数定义起始行)。vendored 源(third_party/bash @ b4608166,bash-5.3 patch 15)中引文在 subst.c:12626,已改标。
  3. fix(expand): #843 — E400-escape user PUA codepoints in the patsub replacement pipeline #853 CR NIT-1(第 5 项):patsub 替换侧展开被标为 subst.c:4462 expand_string_for_rhs(那是 =/:= 的 RHS 展开器)——更正为 subst.c:3950 expand_string_for_patsub(parameter_brace_patsub:9433 调用),涉及 tests/issue843_、tests/issue323_、expand_braced_replacement.rs:553 三处;ANSI-C 解码链(expand_string_for_pat → call_expand_word_internal → ansicstr)语义论证逐字保持成立。parameter_ops/parameter_words/issue315/issue428 等处合法的 RHS 用法 4462 一律不动。

票面第 3/4 项(niubash typeahead_guard.rs "head" 注释、repl.rs:734 cast)系跨仓项,票面自述放 niubash 侧同步票,不在本仓。

⚠️ 基线裁定(对 CR-841 NIT-1 处方数字的一处偏离,请重点审):CR-841 处方为 12601→12611、6643→6641。实测这组数字是 pristine bash-5.3.0 tarball 行号(pristine:comsub_shouldquote@6641、判定注释@12611);而本仓子模块 pin 在 bash-5.3 patch 15(b4608166):comsub_shouldquote@6643(6641 处是空行)、判定注释@12626。仓内坐标基线铁证是 mirror:AGENTS.md 权威坐标表 4/4 精确匹配 patch 15(string_extract_verbatim 1148 / command_substitute 7143 / parameter_brace_expand 9777 / expand_word_list_internal 13219,pristine 分别为 1146/7136/9770/13204),且全仓既有引用(process_substitute 6362、read_comsub 6682、expand_string_for_rhs 4462)均对齐 mirror。因此本 PR 未采纳 6641(会把引文指到 vendored 源的空行;现有 6643 本就正确,保持不动),判定注释引文处 12601→12626。若维护者裁定基线应为 pristine tarball, reverted 即两处行号,欢迎拍砖。CR-853 的 3950 与 mirror 一致,照单采纳。

#716 死文档链接——已在 master 修复,本 PR 无 diff

8a92ee4(PR #722)已把悬空指针替换为诚实指法(issue tracker 为现状记录 + git show 47440833^:docs/TASK-BOARD.md 历史取阅)。本次核实:历史对象存在(git cat-file -e 47440833^:docs/TASK-BOARD.md 通过);docs 树全量 grep 仅剩两处提及且均为历史取阅指法(ledger:3、archived-metrics-snapshot:145),无同型死链残留。

#768 README byte-identical 措辞——本 PR 落地

Byte-identical: 82 suites (0 diff) 紧挨 Env-zeroed: 列表,字面读作原始 stdout 逐字节相等(若 82 套真零差异则无环境差可归零,两行互斥)。README.md 与 README.zh-CN.md 两处均改为显式声明口径:环境审计后计(即表头 "environment-bound diffs counted as zero after audit" 的定义),并指回 README:17 的精确表述(82 逐字节 + nameref 唯一残差行已证明为 GNU 自身 coproc 收割竞态)。数字一律未动;#768 提出的派生化 Env-zeroed 列表(从台账数据生成)不在本票范围,留作后续。

#767 true-baseline 双 helper 实现——已在 master 修复,本 PR 附实测证明

a5980de 已按票面选项 1+预检双落地:support/{recho,zecho}.c 为唯一实现(oracle 侧 gcc ELF 载体),scripts/test-helpers/*.rs 为 required-byte-exact PE 端口(rubash 侧),每次运行双载体从源重建,helper-parity 预检不绿拒绝起账(gate FATAL exit 9 / report-only 层只记录不拦)。本 PR 在本分支新构建的 rubash.exe 上实跑:gate green(24 ok,2 report-only=引擎 byte-reencoding 家族,脚本文档明确不记 helper 账),alias 套件台账 alias 0 env=0。无新增 diff。

验证

  • 纯注释/docs:cargo fmt --check 干净;debug 构建绿。
  • 触碰面套件全绿:issue323 11/11、issue832 5/5、issue843 12/12、issue383 12/12、issue158 5/5。
  • cargo test --lib 689/689(--test-threads=1);默认并行下 executor::path 的 windows_listing_cache 时序 flake 偶发(隔离重跑、单线程、pristine master 均绿,预存现象,与本 diff 无关——注释不进 codegen)。
  • 全仓 grep 无残留:locale.rs:545 0 处;patsub 语境的 4462 0 处(余下 4462 均为合法 RHS 引用);12601 仅剩 compat_issue_regressions:1947 的函数定义引用(mirror 12601 即 glob_expand_word_list 定义起始,准确保留);6641 0 处。
  • CHANGELOG 核实:当前 master 的 CHANGELOG.md 不含 12601/6643/4462 坐标(两条 CR 所指 "CHANGELOG" 是已合并 PR 描述里的拟稿),无可修条目;注释卫生不新增 CHANGELOG 条目(循 fix(#824): decode-boundary leak asserts fired on user-literal marker text (HD1 in declare -p, guard in xtrace) #838 docs-only 先例)。
  • GPL 红线:全部改动为行号/函数名语义引用与注释改写,无 C 片段、无 GPL 文本。

…itation, judgment-comment line, patsub expander attribution

Three rubash-side items of the #849 hygiene pack (items 3/4 are the
niubash-side typeahead_guard.rs comment and repl.rs cast, tracked in the
cross-repo ticket):

1. pipeline_exec.rs (wc fast paths): the comments claimed feeding payload
   text to decode_to_visible_text 'trips its postcondition (locale.rs:545)'.
   The whole output-side debug_assert block was removed by #838 (fires on
   well-formed user-literal marker text, #824) — the citation is dead and
   the line number was stale even before. The prohibition itself stands:
   a payload control byte (0x11) is decoded as the CTLESC carrier that
   consumes the following character, so the corruption is now silent.
   Comments state that mechanism; no assertion is claimed.

2. glob.rs doc + tests/issue832_* header: both quote the glob_expand_word_list
   judgment comment ('If the word isn't an assignment and contains an
   unquoted pattern matching character, then glob it') but cited subst.c:12601
   — the function's definition start. In the vendored source
   (third_party/bash @ b4608166, bash-5.3 patch 15) the quoted words sit at
   subst.c:12626. CR-841 NIT-1's prescribed 12611/6641 are pristine
   bash-5.3.0 line numbers (verified: pristine 5.3.0 has
   comsub_shouldquote@6641, patch 15 has it @6643 — already cited correctly
   everywhere, left unchanged; AGENTS.md's coordinate table matches the
   patch-15 baseline 4/4). Correction targets the mirror baseline: 12626
   where the comment is quoted; the function-definition citations keep 12601.

3. tests/issue843_*, tests/issue323_*, expand_braced_replacement.rs: the
   patsub replacement-side expansion was attributed to 'subst.c:4462
   expand_string_for_rhs' — that is the =/:= RHS expander (#853 CR NIT-1).
   The patsub expander is subst.c:3950 expand_string_for_patsub, called at
   parameter_brace_patsub:9433; the ANSI-C decode chain runs
   expand_string_for_pat -> call_expand_word_internal, so the downstream
   ansicstr claims stay verbatim-true. Legitimate RHS uses of 4462
   (parameter_ops/parameter_words/issue315/issue428/command_prepare) are
   untouched.

Comment-only: zero behavior change. cargo fmt --check clean; touched
suites green (issue323 11, issue832 5, issue843 12, issue383 12,
issue158 5); lib 689/689 with --test-threads=1 (one pre-existing
parallel-timing flake in executor::path windows_listing_cache, green in
isolation and on pristine master).
…measure (env-audited, not raw stdout equality)

'Byte-identical: 82 suites (0 diff)' sat directly above the Env-zeroed
list, so it read as raw stdout byte-equality — which cannot coexist with
an env-zeroing list (if 82 suites had literally zero diff there would be
nothing left to zero). Both READMEs now say explicitly what the 82 is:
byte-identical under the env-audited measure defined in the block header
('environment-bound diffs counted as zero after audit'), not raw
equality — the same precise claim README line 17 makes (82 byte-identical
suites plus nameref's single residual line proven to be GNU's own coproc
reap-timing race). Numbers unchanged; wording only.
@caomengxuan666

Copy link
Copy Markdown
Member Author

独立评审(CR-865)— 结论:APPROVE-WITH-NITS

对 mirror 基线裁定的独立意见:同意,证据充分,裁定正确。 独立复核两侧真值:

  • 本仓 pin(third_party/bash @ b4608166 = bash-5.3 patch 15):comsub_shouldquote@6643(6641 为空行)、判定注释@12626-12627、glob_expand_word_list 定义起于 12601(函数名在 12602)、expand_string_for_patsub@3950(parameter_brace_patsub 调用点@9433)、expand_string_for_rhs@4462。
  • pristine bash-5.3 tag(b8c60bc9):comsub_shouldquote@6641、判定注释@12611 —— 与 CR-841 处方数字逐一吻合,证明处方引自 pristine tarball 行号。
  • AGENTS.md 权威坐标表 4/4 与 patch 15 精确匹配(string_extract_verbatim 1148 / command_substitute 7143 / parameter_brace_expand 9777 / expand_word_list_internal 13219;pristine 侧实为 1146/7136/9770/13204);既有引用 process_substitute@6362、read_comsub@6682 亦均对齐 mirror。拒绝 6641 正确——那在 vendored 源里是空行;6643 保持不动正确;12601→12626 正确。

逐项复核(全部实做)

  1. wc 快路两处注释(pipeline_exec.rs ~3582/~3879):机制陈述属实——CTLESC='\u{11}'(markers.rs:82),decoder 侧测试名即 decode_to_visible_text_ctlesc_protects_next_char;fix(#824): decode-boundary leak asserts fired on user-literal marker text (HD1 in declare -p, guard in xtrace) #838(merge 49e7c1f)确已整体移除输出侧断言,locale.rs 现存 marker debug_assert family: user-literal text panics debug builds at two more decode boundaries (HD1 in declare -p; PARAM_WORD_BACKSLASH_GUARD in xtrace) #824 注释自证"无输出侧断言";全仓 grep locale.rs:545 = 0。
  2. glob.rs + tests/issue832 头:引文移标 12626 正确;issue832 既有 6643 引用不动正确。
  3. patsub 归因 4462→3950:链路在 mirror 逐行验证——expand_string_for_patsub(3950) → expand_string_for_pat(3958 调用) → call_expand_word_internal(4522 调用) → expand_word_internal,下游 ansicstr 论证逐字成立;pathexp.c:66、pat_subst:9252(strcreplace flags=2 调用点)、stringlib.c:180 均准确。残留 4462 全部为 parameter_ops/parameter_words 的合法 RHS 引用与一处 parse.y:4462——正确保留。12601 仅剩 compat_issue_regressions.rs:1947 的定义引用,保留正确;6641 全仓 = 0。
  4. docs: cross-platform-gap-ledger.md points at a non-existent docs/TASK-BOARD.md as current authority #716:8a92ee45 确在 origin/master;git cat-file -e 47440833^:docs/TASK-BOARD.md 通过;docs 树提及仅 cross-platform-gap-ledger:3 与 archived-metrics-snapshot:145,均为历史取阅指法。本 PR 无 diff——正确。
  5. tests: true-baseline runs two different test-helper implementations (Rust recho/zecho vs support/recho.c) and diffs their output — 9 of the 21 residual suites depend on them #767:a5980def 确在 origin/master。本人在本分支新构建的 rubash.exe 上经 WSL 实跑 true-baseline 预检:helper-parity: gate green(24 ok,2 report-only = recho/zecho caf\xc3\xa9 byte-reencoding 家族),alias 台账 alias 0 env=0——与主张完全一致。
  6. docs: README "Byte-identical: 82 suites (0 diff)" reads as raw equality; raw measures 61-62 on the canonical script, and the Env-zeroed list is shorter than the residual set #768:两 README 数字未动,措辞改 env-audited 口径;紧邻表头 "…counted as zero after audit" 的口径定义真实存在,互斥读法已消除。
  7. 门禁:cargo fmt --check 干净;lib --test-threads=1 多轮 689/689(见备注);触碰面 issue323 11/11、issue832 5/5、issue843 12/12、issue383 12/12+9/9、issue158 5/5 全绿;两提交文件集 = PR 文件集(commit1 六个代码/测试文件 + commit2 两个 README),无夹带;CHANGELOG 确无坐标条目可修。

非阻塞备注

  • README 措辞 "Byte-identical: 82 suites byte-identical (0 diff)" / "逐字节一致:82 套件逐字节一致" 标签与值重复,读感略赘(纯外观,可不动)。
  • compat_issue_regressions.rs:1947 保留的 12601 指定义起始行(static WORD_LIST *),函数名实际在 12602——依本仓定义行引用惯例成立,仅备注。
  • lib 单线程下 executor::path::tests::windows_listing_cache_* 偶发时序 flake(本侧约 12 跑 2 现,path.rs:5446)。该模块未被本 PR 触碰、注释不进 codegen,与本 diff 无关,与 PR 披露一致。
  • PR 正文称 README 改动"指回 README:17",实际 diff 措辞为 "the header line above"——实质成立(表头确有该口径定义),仅提法出入。

评审于自建 worktree(rubash-cr-865)独立完成,不合并;worktree 已清理。

@caomengxuan666
caomengxuan666 merged commit bd24cf8 into master Oct 19, 2026
8 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 20, 2026
… clean (zh-CN synced) (#932)

* docs(readme): #768 — split the byte-identical number into raw + env-classified + clean

"82 suites byte-identical (0 diff)" sat one line above an Env-zeroed
list and read as raw output equality. The two cannot both be raw: if 82
suites literally had 0 diff, nothing would remain to zero. Re-measure on
current master (scripts/true-baseline.sh unmodified, WSL GNU 5.3.0) puts
raw byte-identical at 61-62/83, with 21-22 residual suites.

The block now states the three numbers separately instead of one
ambiguous "byte-identical": raw 62/83 (literal 0-diff runs), +20
environment-classified (per-line attribution in the ledger: host-tool
output, NTFS filename/attr bits, locale, /dev/tty, path form, signal
table, coproc reap timing), clean 82/83 — plus nameref's proven-GNU
coproc race for the 83rd. The hand-typed Env-zeroed name list is
replaced by a derivation note so it cannot drift from the artifact, and
the per-suite class set is stated to come from the ledger's own
classification (AGENTS.md rubash-caused vs environment-caused split).

* docs(readme.zh-CN): #890 CR — sync zh-CN to the raw/env-classified/clean framing

Implements the REQUEST-CHANGES findings on #890: mirror the English
README's three-metric ledger block in README.zh-CN.md.

- L17: split "82 套逐字节一致" into raw 62/83 + 20 env-bound-classified
  + nameref's proven-GNU coproc race
- Ledger block: replace the #865-era env-audited gloss with
  原始值/环境归类/净化值 rows matching the EN Raw/Env-classified/Clean
- Drop the hand-typed 归零的环境差 12-name list — it had drifted:
  extglob/ifs-posix/quotearray are 0-diff in the current ledger and not
  among the §4 residual 20; add the same derivation note as EN before
  the suite list

Numbers are ledger-recorded values from
docs/nameref-suite-residual-gnu-race-20261012.md §4-5 (2026-10-12 clean
re-run on 764b9dd), not a new measurement.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: arookieofc <[email protected]>
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 deleted the fix/hygiene-849 branch October 23, 2026 08:54
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