Skip to content

chore(vendor): bump third_party/bash to Bash-5.3 patch 20 (9c465866) (#895) - #957

Merged
caomengxuan666 merged 1 commit into
masterfrom
chore/bash-5.3-bump
Oct 21, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
chore/bash-5.3-bump

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

third_party/bash vendored mirror bump: b4608166 (Bash-5.3 patch 15) → 9c465866 (patch 20, savannah master HEAD). Execution-time re-check: ftp.gnu.org bash-5.3-patches/ lists bash53-001..020, no 021+; mirror master fast-forwarded (b4608166..9c46586).

补丁逐条(5 个 upstream commit)

补丁 Commit 内容 触及文件
16 a5f4367 macOS PIPESIZE_DYNAMIC:heredoc 管道写端设 non-blocking,ENOSPC/EAGAIN 回退临时文件(general.c sh_setnodelay + redir.c;configure-gated,仅 darwin) configure*, general.c/h, redir.c
17 ee9a3ce readline 重绘:多字节 locale 下改用 buffer 偏移(pmt_offset + local_prompt_len)而非物理提示词长度判定"光标在最后一个不可见字符前→从第 0 列重打" lib/readline/display.c
18 49502f0 CHECK_INV_LBREAKS() 修补 >256 折行提示词崩溃;共享前缀落在终端转义序列内时整段重打提示词 lib/readline/display.c
19 549639c legal_variable_starter/legal_variable_char 由 ISALPHA/ISALNUM 改为 sh_syntaxtab CNAMESTART/CNAME——在 isalpha(3) 承认 128-255 字节的系统上防止高位字节混入标识符 general.h, mksyntax.c, syntax.h
20 9c465866 SIGWINCH 后无条件 _rl_reset_prompt()(每次 resize 都重算提示词折行列,不再只在变窄时) lib/readline/display.c

git diff b4608166..9c465866 -- tests/ = 空(83 套语料字节级不变);parse.y/subst.c/execute_cmd.c/jobs.c/variables.c 等坐标表文件全部未动。rubash 不编译 vendored C(Cargo.toml 仅 exclude),bump 对引擎行为构造上无影响。

坐标表重录(AGENTS.md Verified GNU entry points)

p15→p20 实际漂移仅两处:

  • subst.c dequote_word:4865 → 4866(函数名行;4865 是返回类型行,与表内其他条目惯例统一)
  • print_comsub:表中 parse.y:4632 实为调用点;定义在 print_cmd.c:164,已更正并保留调用点备注

其余条目(parse.y 5305/5366-5398/5694-5706/3877/4451、parser.h:51、parse.y 7048/7127、subst.c 全部、redir.c:298、execute_cmd.c:624、jobs.c:3064、nojobs.c:795)grep 重验无漂移。

Oracle 同步

  • scripts/true-baseline.sh 版本门改为从 third_party/bash/patchlevel.h 读 PATCHLEVEL,要求 version 5.3.<PL>(——门自动跟随 mirror,未来 bump 不再需要改脚本。实测门逻辑:接受 5.3.20、拒绝 5.3.15、拒绝 5.3.2。
  • 版本钉同步:AGENTS.md(CRITICAL 规则 + 基线条目)、CONTRIBUTING.md(Oracle 节,含 Oracle 与 vendored mirror 升级:GNU bash 最新版(执行时取最新,5.3.9 只是贡献者环境非目标)——submodule bump + 坐标表重录 + 83 套重跑 #895 落地说明)、README.md、docs/PROVENANCE.md、scripts/wsl-bash530.sh、scripts/run-perf-suite.sh 由 5.3.0 → 5.3.x。
  • src/executor/arithmetic_aliases.rs 注释按 p19 更正(legal_variable_starter 现为 CNAMESTART 表查询)。
  • owner 侧残留:WSL /usr/local/bin/bash 需按 vendored 树重建到 5.3.20(本会话禁用 wsl,无法代为重建);重建后跑一次 canonical true-baseline.sh 全量即可,版本门已就位。

83 套对质(无 wsl 约束下的测量)

  • 方法:Windows 原生跑 rubash 侧全量 83 .tests(复刻 true-baseline.sh 的 rubash 侧机制:LF 归一、recho/zecho.exe rustc 现编、per-suite TMPDIR、__RUBASH_NO_UPSTREAM_SCRIPTS=1、timeout --foreground -k 5 40/120、干净环境),对质对象为主检出 2026-10-17 录制的 gnu.out(oracle 5.3.15)。
  • 对质合法性:016 仅 darwin、017/018/020 为交互式 readline 重绘、019 在 isalpha 已排除高位字节的平台上是 no-op——5.3.15 与 5.3.20 oracle 在非交互语料上产出等价。
  • 结果:target/issue-suites/results/true-baseline-win-p20/ledger.log——62 套 0 差;非零集中在已知/环境类(cond 100、printf 44、glob 37、history 20、assoc 22 等引擎既有差;case/extglob/nquote 的 env=N 全部为 NTFS 非法文件名归类)。parity-vs-oct17.log:67/83 与录制 rb.out 完全一致;差异 16 套归因两类——录制方环境污染(WINUXSH_ROOT/winuxcmd 路径渗入 dstack/assoc/new-exp/coproc 等,本跑已 unset THIS_SH+WINUXSH_* 后转好:dstack 录制 50→现 0)与 master 引擎漂移(与 bump 无关)。
  • 顺带发现(master 现状,非本票引入,建议另立项):set -- $xxx""(xxx 未设置)当前 master 丢字段($#=0),GNU/10-17 构建为 argv[1]=<>——exp.tests +8 差、varenv global: 3→bcde、ifs a:b:c:d:e 同类漂移;printf 多字节 od 输出差 44 行待查。

特别覆盖(票面要求)

  • 高位字节标识符(p19):探针 target/issue-suites/results/win-rubash-side/probe-p19-identifiers.sh——é=1/xé=1/_中=2 → command not found(127);export/declare → not a valid identifier(1);unset -v é → (1);unset é → 0(builtins/set.def:897 valid_id==0 → 函数名兜底);$é 保持字面、${é} → bad substitution(1)。全绿;rubash 各 valid_identifier 本即 ASCII-only,与 CNAME/CNAMESTART 表语义一致。
  • 多字节提示词折行(p17/18/20 失效类):ConPTY 探针 target/issue-suites/results/win-rubash-side/cjk-prompt-pty.py 四腿全绿——双宽 CJK 提示词行内编辑不花屏(p17 类)、1100 字 CJK 提示词 @ COLS=8(~275 折行)命令照常执行不崩(p18 崩溃类)、\[\e[..m\] 转义前缀 CJK 提示词重绘(p18b 类)、会话中途 setwinsize 放大后重绘正常(p20 类)。注:rubash 用自己的 console readline,测的是同一失效类而非被补代码本身;raw PTY 流取证(大屏重绘会冲刷 pyte 视窗)。

Test plan

  • submodule 9c465866 = savannah master HEAD,mirror 已 fast-forward 推送
  • 补丁 16-20 逐条过(commit diff 正文)
  • 坐标表 p20 重录(全条目 grep -n 重验)
  • true-baseline.sh 版本门 5.3.20 接受 / 5.3.15、5.3.2 拒绝
  • 83 套 rubash 侧对质录制 oracle artifact(ledger + parity 日志落盘)
  • p19 高位字节标识符探针全绿
  • CJK 提示词 PTY 四腿全绿(含 >256 折行无崩溃)
  • owner 残留:WSL oracle 重建 5.3.20 + canonical true-baseline.sh 全量(需 wsl,本会话禁用)

Refs #895

Generated with Devin

…895)

Mirror fast-forwarded b4608166 (p15) -> 9c465866 (p20); savannah master
HEAD verified, ftp.gnu.org shows bash53-016..020 with no 021+.

Patch-by-patch (commit summaries):
- 016 a5f4367: macOS PIPESIZE_DYNAMIC heredoc pipe (general.c sh_setnodelay,
  redir.c tempfile fallback on ENOSPC/EAGAIN; configure-gated, darwin only)
- 017 ee9a3ce: readline redisplay uses buffer offset (pmt_offset +
  local_prompt_len) instead of physical prompt length for the
  reprint-from-column-0 decision in multibyte locales
- 018 49502f0: CHECK_INV_LBREAKS while copying local_prompt_newlines (crash
  on >256 wrapped prompt lines) + reprint whole prompt when the shared
  prefix ends inside a terminal escape sequence
- 019 549639c: legal_variable_starter/legal_variable_char move from
  ISALPHA/ISALNUM to sh_syntaxtab CNAMESTART/CNAME (ASCII-only names on
  systems whose isalpha(3) admits bytes 128-255)
- 020 9c465866: _rl_redisplay_after_sigwinch always re-runs
  _rl_reset_prompt() (recompute wrap columns on every resize)

tests/ is byte-identical (git diff --stat empty), so the rubash-observable
surface does not change; rubash never compiles vendored C.

Coordinate table re-recorded against p20: only drift was subst.c
dequote_word 4865->4866 (name line); print_comsub is defined in
print_cmd.c:164 (the old parse.y:4632 entry was the call site). All other
anchors unchanged (parse.y/subst.c/redir.c/execute_cmd.c/jobs.c/nojobs.c
untouched by 016-020).

Oracle sync: scripts/true-baseline.sh version gate now reads PATCHLEVEL
from the vendored patchlevel.h and requires "version 5.3.<PL>(" — the
gate follows the mirror, so future bumps need no script edit; verified
accept 5.3.20 / reject 5.3.15 / reject 5.3.2. Version pins in AGENTS.md,
CONTRIBUTING.md, README.md, docs/PROVENANCE.md, run-perf-suite.sh,
wsl-bash530.sh moved from 5.3.0 to 5.3.x. arithmetic_aliases.rs comment
updated for the CNAMESTART table.

83-suite ledger: rubash-side run on Windows against the recorded
2026-10-17 oracle gnu.out artifacts (oracle 5.3.15 == 5.3.20 for this
non-interactive corpus; 016 is darwin-only, 017/018/020 are interactive
readline redisplay, 019 is a no-op where isalpha already excludes
>=128). 67/83 byte-identical to the recorded rubash run; residual diffs
are env-bound (NTFS-illegal filenames, missing locales, THIS_SH base
name) or current-master engine drift unrelated to the bump. Full ledger
under target/issue-suites/results/true-baseline-win-p20/. Owner-side
residual: rebuild /usr/local/bin/bash to 5.3.20 and re-run the canonical
WSL ledger.

Special coverage: bash53-019 probe (high-byte identifiers) all green —
UTF-8/CJK names rejected in assignment/export/declare/unset -v/${...},
plain unset falls to function-name semantics (set.def:897), $<byte>
stays literal. CJK-prompt ConPTY probe (p17/18/20 failure classes):
double-width prompt edit, >256-wrapped-line prompt (275 lines, no
crash), escape-prefixed CJK prompt, mid-session resize redraw — all 4
legs green.

Refs #895

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 merged commit ada0d32 into master Oct 21, 2026
8 checks passed
@caomengxuan666

Copy link
Copy Markdown
Member Author

终审通过,已 squash-merge 为 ada0d32e(ada0d32ed6a6fb8edff4fd05e19c862b4fefebf2)。Refs #895。

这是全项目 oracle 基座变更,按最严标准做了独立复核,全部通过:

1. Submodule bump 干净性(字节级)

  • third_party/bash 指针恰为 9c465866;.gitmodules 未动;mirror 工作区零本地改动。
  • 保真性实证:从 b460816 起逐个应用 ftp.gnu.org 官方 bash53-016..020(GNU patch),终树与本 PR mirror 9c465866 整树 diff 为空(仅 patch 工具留下的 .orig 备份)。mirror 是官方补丁链的忠实 fast-forward。
  • b460816..9c46586 恰好 5 个 commit,作者全部为 Chet Ramey,无夹带。执行时点重检无 021+(与 PR 记录一致;旁证:MSYS2 发行版 bash 现已自带 5.3.20(2))。

2. 五补丁逐条(全 hunk 读毕)

  • 016:PIPESIZE_DYNAMIC 由 configure.ac 的 darwin* 分支注入,Linux/Cygwin 构建下整段编译剔除,oracle 平台零影响。
  • 017/018/020:全部落在 lib/readline/display.c 的 rl_redisplay()/update_line()/_rl_redisplay_after_sigwinch()——纯交互式重绘路径,非交互脚本语料不经过。
  • 019:legal_variable_starter/char 改为 sh_syntaxtab 的 CNAMESTART/CNAME 查表,setnamechars() 把合法字符精确钉死为 ASCII [_a-zA-Z0-9]。仅在 isalpha(3) 承认 128-255 字节的 locale 下有行为差;oracle 平台(en_US.UTF-8,glibc 单字节高位非 alpha)对任意输入与 p15 逐输入等价。rubash 侧 valid_identifier 本就 ASCII-only,此补丁反而收窄双方分歧,无兼容性回归。

3. 坐标表重录核验:AGENTS.md 全表逐条 sed -n 重验,两处修正(dequote_word subst.c:4866、print_comsub print_cmd.c:164 + parse.y:4632 调用点备注)均正确,其余条目无漂移。

4. 83 套证据 + 独立抽验

  • PR 产物落盘核验:target/issue-suites/results/rubash-895-p20/(ledger 83 套齐全;对 10-17 录制的 parity 日志在;非零 20 套全部属于 README 台账已知差类,nameref=1 即 GNU coproc 竞态旧账)。
  • 独立抽验(本评审自行构建真 oracle):在本机 MSYS2 从上述字节验证树编译出 GNU bash, version 5.3.20(1)-release,与 rubash@PR-head 做 10 个 must-match 形对质——10/10 字节一致(含 rc):
    • p19 五腿:é=1(127)、_中=2(127+bad substitution)、declare/export(not a valid identifier)、$((é))/let é=6(operand expected)、unset é(0)/unset -v é(1);
    • 多字节文本两腿:${#s}/${s:0:2} 切片、$xé 判别形(p19 后 $x+字面 é);
    • 既有强形态三腿:dstack dirs/popd、comsub 混合引号、extglob case。
  • 真 readline PTY 腿(PR 未覆盖的加验):上述自建 oracle 自带打上 017/018/020 的 GNU readline,ConPTY 实测三腿——1100 字 CJK 提示词 @ COLS=8(~275 折行 >256,p18 崩溃类)不崩且命令正常执行;CJK 提示词行内退格编辑干净(p17 类);会话中 setwinsize 放大后执行正常(p20 类)。与 PR 侧 rubash 自研 readline 四腿探针互为印证。

5. 依赖面:PR 零触碰 Cargo.toml/Cargo.lock/build.rs/src 逻辑(唯一 rust 改动为注释);vendored bash 在 package exclude 且从不参与编译;sha2 等依赖面不变——niubash CI --locked 无连带,无需跟进票(#939 教训不适用本案)。

6. 小账目备注:PR 正文写"62 套 0 差",ledger 实为 63 套零差(+20 非零 +nameref=1,83 齐账);README master 口径是 62+20+1。纯计数口径差,不影响结论。

7. Owner 残留(唯一未勾选项,不阻塞):WSL /usr/local/bin/bash 重建到 5.3.20 + canonical true-baseline.sh 全量。true-baseline.sh 新版本门自 vendored patchlevel.h 取数,oracle 未重建前会以 exit 9 拒跑——fail-loud,不会静默错基线。#895 保持 open 直至该项清偿。

另记一条与本案无关的现场观察:dirs 在 HOME 之下路径时 GNU 侧输出 ~/... 缩写、rubash 打全路径(本机 Git Bash 5.3.0 与 5.3.20 行为一致,属平台/引擎既有细微差,非本 PR 引入,留作后续兼容台账参考)。

caomengxuan666 added a commit that referenced this pull request Oct 21, 2026
…est platform status, current architecture (#982)

* docs(readme): overhaul — Performance section with pinned numbers, honest platform status, current architecture

- New Performance section, every number pinned to its measuring issue/PR:
  - Android-matrix interpreter triage closed with numbers (#607/#608/#609
    -> #665/#671/#679, #666, #672/#678; net ~1.06x GNU scalar assign)
  - array store O(n^2)->O(1) amortized (#618/#616: assoc 445x->9.9x,
    indexed 736x->3.8x vs GNU at 5000 keys; docs/performance.md ledger)
  - literal fast-path wave with measured deltas: #967 (177->155 ms),
    #966 (1.41x->1.10x), #974 (~11%), #959 (3.65x->3.16x), #958 (-10%),
    #956/#973/#954 family
  - export/unset economics: #916 measured costs stated, write lane landed
    (#917/#918/#920, #943 correctness rework), issue open on residual
  - Windows process economics: #913 one hidden console per session
    (~22 ms/spawn -> <=1 per session; tests/console_window_gate.rs),
    #884 tput inline arm (1165 ms -> 47 ms, 269-row oracle matrix),
    WinuxCmd#1269 twin (~17 ms -> ~0.4 ms in-process), #800 face B open
- Platform status made verifiable: Linux CI lanes + upstream-corpus replay
  job named; 19/24 Linux pass dated and cited (#500) instead of 'and
  climbing'; macOS now runs lib tests in CI, not just compiles
- Architecture tree updated to the real src/ layout (bin/expand/fd/jobs/
  shell added); builtin count 40+ -> 62 engine builtins per the
  test-guarded docs/builtins.md + hidden fast-path builtins
- Testing section: regression suite, console gate, corpus replay commands
- Compatibility baseline line updated to vendored Bash-5.3 patch 20
  (#957) with local+WSL 5.3.20 oracles (#978)
- zh README rewritten to full parity with EN (was still describing the
  pre-dialect path model, missing the identity section, claiming 5.3.0)
- Last-updated stamp refreshed

* docs(readme): date the Linux corpus pass from the archive — 2026-09-27 wt4/linuxrun, 17/24 per its own ledger

The "(2026-09-26, #500)" tag was wrong on both counts: 09-26 is the
earlier "not-yet-usable" judgment (first smoke 8/10, gap-ledger C4) that
the 2026-09-27 wt4/linuxrun lane explicitly declared obsolete, and #500
only carried the figure forward — it is not the measuring record. No
archived record supports 19/24: the lane's own corpus-slice table
(docs/LINUX-RUN-STATUS.md, deleted in #478, archived in #477 section 4
and #581) tallies 17 suites at 0 diff + trap/redir/glob/extglob/new-exp/
read/ifs-posix with diffs = 17/24. README now reads "17/24 byte-identical
(2026-09-27 wt4/linuxrun lane, ledger archived in #477/#581)" in both
the platform-status paragraph and the compatibility table, EN + zh-CN
at parity. Addresses review comment 6319063190 on #982.

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

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

---------

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

Copy link
Copy Markdown
Member Author

复审记录(合并后二次独立核验,无状态变更)

PR 已 squash-merge 为 ada0d32e。本次从干净 worktree @ada0d32e 重新构建引擎(target/debug/rubash.exe 版本横幅 build: ada0d32e (debug) 证明出处)做了全项复审,结论与终审一致,全部通过:

  1. bump 干净性:95700a5..ada0d32 恰为 PR 的 9 文件 + 指针 b4608166→9c465866;.gitmodules/Cargo.toml/Cargo.lock/build.rs 零触碰。squash 把分支点之后的 master 漂移(35 文件,含 arithmetic_aliases.rs 的 positional_window() 重构)正确合入,PR 侧 9 文件 blob 与 PR head 全同或正交合并。
  2. 上游 diff 全读:b4608166..9c465866 恰 5 commit 全为 Chet Ramey;016 仅 darwin(PIPESIZE_DYNAMIC 双 #if 块,use_tempfile: 标签 redir.c:512 存在);017/018/020 全落 lib/readline/display.c 交互重绘;019 CNAME/CNAMESTART 表由 mksyntax.c 构建期生成、locale.c 只动 CSHBRK/CBLANK,合法字符集精确钉死 ASCII。非交互语料上 p15≡p20 成立。
  3. 坐标表:AGENTS.md 全部条目在 9c465866 逐一 sed -n 对上(含两处修正)。
  4. 83 套账目:ledger.log 83 行与 tests/*.tests 名单精确一致;63 零差 + 20 非零;env=N 仅 case/extglob/nquote(NTFS 归类);parity 67/83。
  5. 独立抽验(本次自建):10 形对 GNU bash 5.3.0(1)-release(msys 官方构建;对本机 isalpha-normal 平台与 5.3.20 逐形等价)stdout/stderr/rc 三路 byte 对质 10/10 一致——p19 五腿(é=1/xé/_中=127、export/declare invalid=1、unset é=0/unset -v=1、$é 字面/${é} bad substitution=1、$((é+1))/let é=6 operand expected)+ 多字节两腿(${#s}/切片/去头尾、CJK 替换/for/case)+ 既有强形态三腿(dstack pushd/popd/dirs、comsub 混引号、case+${v/pat/repl})。另以 PR 的 ConPTY 探针对本构建复跑 4 腿全绿(p17 CJK 行内编辑 / p18a >256 折行不崩 @cols=8 / p18b 转义前缀 / p20 setwinsize 放大重绘)。
  6. CI:PR 检查全绿(cross-target、GNU regression goldens+canaries、Rust tests×2、shell functionality);master ada0d32e CI run success(2026-10-21T02:08:05Z);master HEAD ce627211 亦 success。

运维备注一条(与本票无冲突):仓内 [[bin]] bash 是转发 shim(locate_shell() 找 niu/winuxsh 宿主,找不到即 exit 127),引擎二进制是 target/debug/rubash.exe——任何直接跑 bash.exe 的对质实际测到的是已安装宿主(本次现场为 2ded956 构建),评审/基线测量务必用 rubash.exe。

无阻塞项;#895 保持 open,等待 owner 侧 WSL oracle 重建 5.3.20 + canonical 全量。

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