Skip to content

docs: #878 CR nits — command.def/asciicode coordinate errata + stale regression.rs env comment - #888

Closed
arookieofc wants to merge 1 commit into
masterfrom
arookieofc/fix-878-cr-nits-v2
Closed

arookieofc wants to merge 1 commit into
masterfrom
arookieofc/fix-878-cr-nits-v2

Conversation

@arookieofc

Copy link
Copy Markdown
Member

Closes #878 (the pure-cleanup items). Verified against vendored third_party/bash.

Coordinate errata:

  • command.def if (list == 0) return is at 96-99, not 95-96 (type_builtin.rs, command_substitution_values.rs, tests/regression.rs); the -p restricted block is 98-104, not 97-103 (issue804 test header).
  • printf.def asciicode() body is 1520-1543, not 1519-1544 (printf_tests.rs).

Stale comment (#864 nit): tests/regression.rs run_rubash_in's parenthetical still claimed suite snapshots "deliberately keep the ambient env". The snapshot path switched to the airtight channel (env_clear + whitelist + pinned THIS_SH/TMPDIR) once ambient leakage was shown to make recorded bytes machine-dependent; the comment now reflects that.

Item 7 disposition: the "${x:-a b}"$w quoted-default split is a real semantic divergence — GNU prints a b<W> as a single field, rubash splits into a / b<W> (probed vs WSL GNU 5.3.0). It sits in the same expansion neighborhood as rubash#876 and deserves a dedicated fix, not a partial change inside a comment-only PR. Flagging it for follow-up rather than shipping a half-fix here.

Items 2-4 (the #870 fd-table nits) landed separately in #885 — they are not duplicated here.

Comment-only; zero behavior change; build + fmt + tests/regression 78/78 green.

…regression.rs env comment

Coordinate errata (verified against vendored third_party/bash):
- command.def: the 'if (list == 0) return' early return sits at 96-99,
  not 95-96 (type_builtin.rs, command_substitution_values.rs,
  tests/regression.rs); the -p restricted refusal block is 98-104, not
  97-103 (issue804 test header).
- printf.def asciicode(): the body is 1520-1543, not 1519-1544
  (printf_tests.rs).

Stale comment (rubash#864 nit): tests/regression.rs run_rubash_in's
parenthetical still claimed suite snapshots 'deliberately keep the
ambient env'. The snapshot path switched to the same airtight channel
(env_clear + machine whitelist + pinned THIS_SH/TMPDIR) when ambient
leakage was found to make recorded bytes machine-dependent; the
parenthetical now says so and points at the sibling comment.

Note on item 7 (the quoted-default split residue): probed — GNU prints
'a b<W>' as one field, rubash splits it into 'a' and 'b<W>'. That is a
real word-splitting semantic divergence (same function neighborhood as
the byte/char fix in rubash#876), not a comment nit; tracked for a
dedicated fix rather than a partial change here.

Comment-only; zero behavior change; build + fmt + tests/regression
78/78 green.
@github-actions

Copy link
Copy Markdown
Contributor

欢迎!这是你的第一个 PR 🎉 请确认已跑过本地测试套件;CI 通过后维护者会 review。

@caomengxuan666

Copy link
Copy Markdown
Member

独立评审结论:REQUEST-CHANGES(自建 worktree @ 3e291c8 对基线 2b98675 评审;vendored 对质 = third_party/bash @ pin b460816,bash-5.3 patch 15)

本 PR 的全部交付物就是坐标正确性,但两处核心勘误一处新值仍错、一处只做了一半:

1. command.def 95-96 → 96-99:新坐标仍错,vendored 实为 96-97

builtins/command.def @ b460816 实读:

96|   if (list == 0)
97|     return (EXECUTION_SUCCESS);
98|
99| #if defined (RESTRICTED_SHELL)

早退语句是 96-97(#878 票面第 1 项钉的也是 96-97);98 是空行、99 是 RESTRICTED_SHELL 的 #if,都不属于 "no-operand early return"。本 PR 在 type_builtin.rs:51、command_substitution_values.rs:96、tests/regression.rs:1855 三处写成 96-99,PR 描述 "if (list == 0) return is at 96-99" 与 pin 字节不符。

(考古:旧值 95-96 恰是 bash-5.2 修订 74091dd 的行号——旧注释是按 5.2 写的;5.3 pin 整体 +1 后应为 96-97。96-99 与哪个修订都对不上。)

顺带:issue804…rs:13 的 -p 块 97-103 → 98-104 仍非精确值——vendored 的 if 块是 100-104(99-105 为含 #if/#endif 的 guard 区;拒绝语句本身 102-103),98 是空行。票面虽未钉此项,但坐标勘误 PR 建议一并改准。

2. asciicode → 1520-1543:测试头改对了,票面点名的「契约注释」漏了

  • printf_tests.rs:479 1520-1543 ✅(vendored:1519 返回类型行、1520 函数名行、1543 收 };按「函数名行→闭括号」口径成立,与票面一致)
  • 但 src/builtins/printf/number.rs:133 仍是旧值 (printf.def:1519-1544)。票面第 1 项写明 asciicode 勘误范围是「printf 契约注释**/**测试头」两处,验收为「逐项 grep 确认无残留旧坐标」——grep -rn "1519-1544" src tests 仍命中。该句其余陈述(mbrtowc 转 arg[1]、无 chk_converror)与 vendored 1531-1539/1518 一致,只需改坐标。

已核实为正确的部分

  • 每处改坐标后的括号论证仍成立:早退(实为 96-97)先于 describe 循环(107-122);-p 拒绝先于任何执行;asciicode() 读 arg[1]、无 chk_converror——语义全部对,错的只是坐标本身;
  • regression.rs run_rubash_in 陈旧注释改写已逐句对质 run_suite_snapshot(L522)成立:env_clear(L621)+ Windows 机器白名单(L653-668)+ 钉死的 THIS_SH(L628)/TMPDIR(L649),且 L609-620 的自有注释正是「ambient 泄漏使录制字节机器相关」——新注释与代码现实一致,旧句("deliberately keep the ambient env")确已失实,该改;
  • 越界审计:diff 恰为所列 5 文件、全注释、零行为变化、submodule 指针未动;
  • GPL:未新增拷入 GPL 文本(唯一 C 引文 if (list == 0) return … 为 PR 前已有);
  • fmt:5 个触碰文件 rustfmt --check 全绿(整仓 cargo fmt --check 在本机检出路径触发 os error 206,环境问题,已按文件逐一复核);cargo check --tests 警告集合与 master 基线逐条 diff 完全相同 = 零新增。

#878 未覆盖项清单(留给后续,不构成本 PR 的 BLOCKER)

修复清单(改完即可过)

  1. 三处 96-99 → 96-97(type_builtin.rs:51、command_substitution_values.rs:96、regression.rs:1855),PR 描述同步;
  2. number.rs:133 1519-1544 → 1520-1543;
  3. issue804…rs:13 98-104 → 100-104(或 99-105,建议写明含不含 guard 的口径)。
    其余不动。

@caomengxuan666

Copy link
Copy Markdown
Member

独立复审结论:REQUEST-CHANGES(维持)——修复轮尚未推送,待办清零判定 0/3

fetch 复核:head 仍为 3e291c80,与原评审(6270414178)所评 SHA 完全相同(branch arookieofc/fix-878-cr-nits-v2 无新 push,时间线无 synchronize/force-push)。逐项对照原 CR 清单在当前 head 实测:

原待办 状态
1. 三处 96-99 → 96-97(type_builtin.rs:51、command_substitution_values.rs:96、regression.rs:1855)+ PR 描述同步 ❌ 未改:三处源码仍 96-99,描述仍写 "96-99"
2. number.rs:133 1519-1544 → 1520-1543 ❌ 未改:仍 (printf.def:1519-1544)
3. issue804…rs:13 98-104 → 100-104(或 99-105,写明口径) ❌ 未改:仍 98-104

vendored 重对质(third_party/bash @ pin b460816,Bash-5.3 patch 15,自建 worktree 实读):

  • command.def:96-97 = if (list == 0) / return (EXECUTION_SUCCESS);,98 空行,99 = #if defined (RESTRICTED_SHELL),100-104 = -p 拒绝 if 块(拒绝语句 102-103)——原评审坐标(96-97 / 100-104,含 guard 口径 99-105)全部维持成立;
  • printf.def:1519 = 返回类型行、1520 = asciicode (void)、1543 = 收 }(1544 空行)——1520-1543 口径成立;printf_tests.rs:479 已改对,唯 number.rs:133 残留;
  • grep 复核:src+tests 内 96-99×3、1519-1544×1、98-104×1 全部仍在;PR 前旧值(95-96 / 97-103)无残留(本 PR 原有修正无回归)。

越界审计复核:diff 仍恰为所列 5 文件、全注释、零行为、submodule 指针未动——原评审该结论维持。

merge-preview(对最新 master c9e14214,含 #886/#885/#873/#889 合并后):实测合并零冲突;master 自 merge-base 2b986758 起的变更与本 PR 5 文件零交集。叠加审计:#886 仅 docs 两文件,无关;#887(rubash#881 handshake 注释三件)只动 kill.rs / compound_exec.rs,与本 PR 无同区注释、无语义耦合(另注:#887 的 merge commit 25bcdcea 目前落在 fix/866-867 分支、尚未进入 master 历史,不影响本审计)。顺带:描述中 "landed separately in #885" 随 #885 已合并(d3528dcc)现为准确表述。

待办 = 原评审修复清单 3 项 + 描述同步,一项未动。补 push 后可直接复审批准,无需重复本页审计。

@caomengxuan666

Copy link
Copy Markdown
Member

独立复审结论:REQUEST-CHANGES(维持)——head 未动,修复清单 0/3

第三方复核(自建 worktree @ 3e291c80,vendored 对质 = third_party/bash @ b460816,bash-5.3 patch 15)。fetch 确认 head 与前两轮评审(6270414178 / 后续复审)所评 SHA 完全相同,无 synchronize/force-push。逐项在当前 head 实测:

待办 状态
1. 三处 96-99 → 96-97(type_builtin.rs:51、command_substitution_values.rs:96、regression.rs:1855)+ PR 描述同步 ❌ grep 实测三处仍 96-99
2. number.rs:133 1519-1544 → 1520-1543 ❌ 仍 (printf.def:1519-1544)
3. issue804…rs:13 98-104 → 100-104(或 99-105,写明口径) ❌ 仍 98-104

vendored 实读与原评审一致:command.def:96-97 = if (list == 0) / return (EXECUTION_SUCCESS);,98 空行,99 = #if defined (RESTRICTED_SHELL),-p 拒绝 if 块 = 100-104(99-105 含 guard);printf.def:1519-1520 = 返回类型行/函数名行、1543 收 }。

前轮已核实为正确的部分本次维持成立:printf_tests.rs:479 的 1520-1543 ✅;regression.rs run_rubash_in 陈旧 env 注释改写与 run_suite_snapshot(env_clear L621 + Windows 白名单 L653-668 + 钉死 THIS_SH L628 / TMPDIR L649)逐句对质成立;越界审计通过(diff 恰为 5 文件、全注释、零行为);旧坐标(95-96 / 97-103 / printf_tests 侧 1519-1544)无残留。

merge-preview:对当前 master 9f512fc5(#915 合并后)git merge-tree 实测零冲突,无需 rebase。

待办 = 原评审修复清单 3 项 + 描述同步。补 push 后按前轮结论可直接复审批准,无需重复本页审计。

@caomengxuan666

Copy link
Copy Markdown
Member

评审修复清单已在新 PR #933 落地(head 基于本 PR 的 3e291c80,原作者提交保留):

  • 三处 command.def:96-99 → 96-97(type_builtin.rs:51 / command_substitution_values.rs:96 / regression.rs:1855)
  • number.rs:133 (printf.def:1519-1544) → (printf.def:1520-1543)
  • issue804…rs:13 command.def:98-104 → 100-104,并内联写明口径(if 块 = 100-104,#if/#endif guard = 99-105)

全部对质 vendored third_party/bash @ b460816;grep -rn -E "96-99|98-104|95-96|97-103|1519-1544" src tests 零残留;cargo check --tests 与 rustfmt 干净,改动仍全为注释。

maintainerCanModify=false,无法直接推本分支,故开 #933 并互链——实现的是评论 6289975215 的评审发现,原作者优先、先到先得。

caomengxuan666 added a commit that referenced this pull request Oct 20, 2026
#888 review) (#933)

* docs: #878 CR nits — command.def/asciicode coordinate errata + stale regression.rs env comment

Coordinate errata (verified against vendored third_party/bash):
- command.def: the 'if (list == 0) return' early return sits at 96-99,
  not 95-96 (type_builtin.rs, command_substitution_values.rs,
  tests/regression.rs); the -p restricted refusal block is 98-104, not
  97-103 (issue804 test header).
- printf.def asciicode(): the body is 1520-1543, not 1519-1544
  (printf_tests.rs).

Stale comment (rubash#864 nit): tests/regression.rs run_rubash_in's
parenthetical still claimed suite snapshots 'deliberately keep the
ambient env'. The snapshot path switched to the same airtight channel
(env_clear + machine whitelist + pinned THIS_SH/TMPDIR) when ambient
leakage was found to make recorded bytes machine-dependent; the
parenthetical now says so and points at the sibling comment.

Note on item 7 (the quoted-default split residue): probed — GNU prints
'a b<W>' as one field, rubash splits it into 'a' and 'b<W>'. That is a
real word-splitting semantic divergence (same function neighborhood as
the byte/char fix in rubash#876), not a comment nit; tracked for a
dedicated fix rather than a partial change here.

Comment-only; zero behavior change; build + fmt + tests/regression
78/78 green.

* docs: #878 CR rework — correct command.def/printf.def coordinates per #888 review

Implements the review findings on #888 (comment
6289975215), verified byte-for-byte against vendored third_party/bash
@ b460816 (bash-5.3 patch 15):

- command.def: the `if (list == 0)` no-operand early return is 96-97
  (96 = if, 97 = return; 98 is blank, 99 is `#if RESTRICTED_SHELL`),
  not 96-99 — fixed in type_builtin.rs, command_substitution_values.rs,
  tests/regression.rs.
- command.def: the -p restricted refusal is the use_standard_path &&
  restricted if-block at 100-104 (the enclosing #if/#endif guard spans
  99-105), not 98-104 — issue804 test header now states the
  if-block/guard convention inline.
- printf.def: asciicode() is 1520-1543 (function-name line to closing
  brace); the contract comment in printf/number.rs:133 still carried
  the old 1519-1544 — fixed to match printf_tests.rs:479.

Residual-coordinate grep is clean: no 96-99/98-104/95-96/97-103/
1519-1544 left in src/ or tests/. Comment-only; zero behavior change;
rustfmt clean on all touched files; cargo check --tests warning set
unchanged.

Refs #878

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

Copy link
Copy Markdown
Member

Review findings implemented in #933 (merged to master as 7b976d0).

@caomengxuan666

Copy link
Copy Markdown
Member

The coordinate errata this PR targets has landed via #933 (squash 7b976d0, includes the corrected 96-97 values at all three sites + the number.rs:133 cleanup + precise issue804 header). Thank you @a-rookie-of-C-language for the original work — closing as superseded; your branch remains for reference.

@caomengxuan666
caomengxuan666 deleted the arookieofc/fix-878-cr-nits-v2 branch October 30, 2026 01:41
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.

CR nits 汇总 v2(#854/#869/#870/#873 四轮):坐标勘误×2、双点钉死、死字段、注释三件、陈旧注释、引号默认值残差

2 participants