Repository navigation
fix(executor): inline tput arm — Windows-only whitelist answers byte-equal to GNU ncurses (#800 face A) - #884
Conversation
独立代码评审结论:REQUEST-CHANGES(1 BLOCKER)评审树:自建 detached worktree @ a56ee41( BLOCKERB1:前导零/带符号数值操作数——admitted 形状字节背离 GNU oracle(strtol base-0 八进制语义)自跑 535 行 TERM×capability×参数 差分矩阵(7 TERM × 9 无参 cap;setaf/setab × 25 数值形 × 7 TERM;cup × 11 形 × 4 TERM;7 控制 TERM × 5 形;20 非准入调用形;simple / 管道 / comsub / tempenv 四形状;stdout+stderr+rc 全对照),除下述家族外 admitted 全部字节吻合。抓到的分歧(simple 形状示例,管道/comsub/tempenv 形状同样分歧):
根因:GNU tput 数值操作数走 C 这违反本臂自设的核心不变量(模块头:「Every admitted (TERM, invocation) pair answers with bytes verified byte-for-byte against the GNU oracle」;rubash#117 纪律:准入必须 provable)。 修法建议(白名单纪律下应收窄而非仿制): 逐验证点复现结果(全部实做)
非阻塞备注
结论REQUEST-CHANGES。仅 B1 一项阻塞;其余全部验证点独立复现通过,实现质量高(接线位、TERM 解析、计时、回归卫生都干净)。B1 是窄化准入的一行级修复 + 矩阵补钉;修复后重跑字节门与 issue800 8/8 即可,其余验证不受影响。B 面(read on-EOF)留票正确。不合并。 |
…iring, perf probe 31, regression tests
…arses operands with strtol base-0 (CR #884 B1) GNU tput reads setaf/setab/cup operands via strtol base-0: '010' is octal 8 (\e[38m), '+010' signed octal, '009'/'08' truncate at the first illegal octal digit (\e[30m), '000000000010' is octal 10 — every one byte-diverges from the arm's decimal read (setaf 010 answered \e[310m). The prior regression pinned setaf 007, where octal and decimal coincide, so 8/8 green masked the family. Per the CR's prescribed move the arm narrows instead of replicating strtol: operands must be canonical decimal (no sign, no leading zero beyond the literal '0', 0..=255) or the shape falls through to the real binary, whose base-0 semantics keep answering. Pins added: strtol/ family rows in the byte-gate matrix (GNU answers recorded as evidence), a host-tolerant integration test asserting the decimal misread never appears, and unit rows for every rejected spelling. Byte gate re-run post-rebase on master 78952f5: 3175 admitted rows (full 0..255 setaf/setab sweeps, xterm/xterm-256color/screen/ screen-256color/linux/tmux-256color + no-param caps + cup shapes + tempenv/export/redirect) byte-identical to WSL GNU ncurses tput; 36 strtol rows recorded, zero decimal misreads. issue800 suite 9/9 + tput unit tests 3/3. Also moves the Windows-only stand-in comment off parameter_errors onto mod tput_emulation (CR nit N3).
a56ee41 to
8962259
Compare
The call sites guard with cfg!(windows) && tput_inline_stage(command), but cfg! is a compile-time constant — the function must still exist on non-Windows targets. Provide a stub returning false so Linux/macOS CI compiles (the arm is Windows-only by design: it exists to dodge the ~300ms Windows spawn floor, and the predicate is always false off Windows).
CR #884 (复审 @
|
…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>
根因(#800 A 面:Windows 外部进程 spawn 成本)
harvest runner 上每次
$(tput …)spawn 计价 ~300ms(kiddae/dotfiles hermine.bashrc~32 次 → source_wall 9.7s)。分诊证明成本不在 rubash spawn 路径:同机 32×uname地板与 master 持平(benchmarks/29 形状);同一个 winuxcmd 4MB 二进制true~1ms/次 vstput bold~17ms/次——成本在 tput 子进程内部,再乘 harvest runner 环境系数(AV/冷 VM)。有效修法是让准入形状免 spawn 进程内作答,而非继续调 spawn 路径。变更(Windows-only)
src/executor/tput_emulation.rs(新):纯白名单表——TERM ∈ {xterm, xterm-256color, screen, screen-256color, tmux-256color, linux, vt100} × {bold, sgr0, clear, civis, cnorm, el, ed, smcup, rmcup, setaf, setab, cup}。**非准入形状一律回退真二进制:本臂只删 spawn,从不改答案。**缺席能力 → 静默 rc 1(ncurses 契约)。external_file_builtins.rs::external_tput(tty/cat/sed 先例;hash 记录 PATH 二进制;child-visible TERM = tempenv 覆盖 > 导出 shell 态,未导出/空回退);pipeline_exec.rs的tput_inline_stage臂,并发路径 bail(tput 毫秒级,放弃并发无损失),非准入仍 spawn;command_substitution_values.rs::run_external_command_substitution的 tput 臂(tty 臂同位先例)。benchmarks/31-tput-colors-x32.sh:票面形状 perf 探针(16 组 ×(bold+setaf),PERF runs=7 timeout=60)。tests/issue800_tput_inline_arm_regressions.rs:8 条回归,钉死 oracle 字节、TERM 解析顺序、捕获/重定向通道、hash 内省、host-tolerant 回退不变量。计时(同机背靠背 A/B,2026-10-19 合并 origin/master 41bfdd3 后复测,median,date +%s%N)
(前一批次同形状:master/pin 1.08-1.16s / 分支 13-16ms;本次 master 中位 1165ms 与其吻合。)
Oracle 证据
269 行 TERM×capability×参数 差分矩阵:diff=0——每行字节对照 WSL GNU ncurses tput(Ubuntu 24.04,ncurses 6.4,od 探针 2026-10-19)。表数据全部来自自跑 oracle 探针的输出字节(未接触 ncurses 源码,GPL 红线未触)。矩阵由
tests/issue800_tput_inline_arm_regressions.rs永久钉死。验证(全部 --test-threads=1,输出落
target/issue-suites/results/)issue800_tput_inline_arm_regressions:8/8(合并 master 后重编译重跑)target/debug/rubash.exe——issue415 coproc 探针 spawn debug 二进制的环境项,补建后全绿);tput_emulation 单测 3/3RUSTFLAGS="-D warnings" cargo build --release:零警告cargo fmt --check:本分支零新增(全仓唯一 diff 在command_prepare.rs:4670,为 mark_quoted_ifs_from_raw simulator is carrier-blind: carrier-laden raw words silently lose per-char IFS marking #868 带入的 master 预存 import 顺序项,已在 pristine 41bfdd3 上核实逐字同款)--no-fail-fast双向(分支 vs pristine master 41bfdd3):317 vs 316 套件(多出的 1 个即本票 8 条新测试,全绿);失败集合完全一致(36=36,全为 master 预存主机面)。分支侧全量首跑曾出现 2 条瞬时红(profiler fixture 树按实测 self-time 排序、listing_cache 依赖 NTFS mtime 时序——两者 fixture 均不含 tput,与本臂无关):两侧隔离/整套复跑均全绿(分支 lib 710 = 基线 707 + 本票 3,精确闭合),判定为负载性 flake。关联
readon-EOF ~4.8s/次不在范围,票保持开放)。