Skip to content

WIP: cli-tests census 清零 #2190 bashdb harness + #2192 TIMEFORMAT 错钉 - #2224

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/census-2190-2192
Oct 30, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/census-2190-2192

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

清 cli-tests 普查最后 5 个名字(#2190 ×3 + #2192 ×2,及 #2192 同钉三号 time_reports)。逐条先对 GNU bash 5.3.20 oracle 定性,结论是五条全在测试面、产品面零改动:

#2190(bashdb_compat ×3)— fixture/harness 腐烂

  • bashdb_debug_nested_shell_preserves_typeset_array_quotes、bashdb_shell_nested_bash_uses_compatible_shim:ensure_bash_shim_fixture 无条件拷贝 CARGO_BIN_EXE_bash,但 bash bin 是 feature 门控的(Cargo.toml required-features = ["windows-shim"],默认 features 为空),Linux cli lane 根本不构建它,拷贝在 bashdb_compat.rs:61 panic(本地 stub launcher 复现了完全相同的 panic 点)。修:shim 路径不存在时回退到引擎二进制本身(fixture 只需要该路径上有一个能用的 bash;真构建 shim 的 lane 继续用真 shim),并在 fixture 根内镜像 configure 期 /usr/local/bin 布局。
  • bash_compat_debugger_options_run_init_file_before_script:旧断言无条件要求 stderr 为空,这只在系统前缀装有 bashdb starter 的机器上成立。starter 搜索是环境属性(src/main.rs start_debugger,对应 GNU shell.c:1547;无 starter 时 GNU 的结局是 shell.c:1556-1561 的诊断对,oracle 已实测同形)。修:lane fixture(target/bashdb-install)存在时把 BASHDB_START_FILE 指向它,无 starter 时断言诊断对;init 先行与脚本输出的断言两臂都保留。

#2192(TIMEFORMAT ×2 + wall-clock 钉 ×1)— 钉的期望与 GNU 模型矛盾(错钉)

  • GNU print_time_info(execute_cmd.c)量的是 RUSAGE_SELF + RUSAGE_CHILDREN 差值;%P 对亚毫秒 builtin 是不稳定比值——oracle 对钉里同一探针五跑给出 1.00/2.00/87.00/90.00/91.00,rubash 给 99.27/99.33,同形。钉里的字面量 cpu:0.00/p:0.00 不是 GNU 不变量。格式展开本身(%R/%U/%S 精度、%2lR 长形、%% 字面量)逐字节合 GNU print_formatted_time(execute_cmd.c:1346),实测输出除 %P 外全合原 regex。修:%P 改形状检查,其余断言保持逐字节。
  • time_reports_elapsed_wall_clock_for_slow_command:sys 恰在 5ms 取整边界上,负载下翻 0.01、隔离跑两壳都稳定 0.00(rubash 独立五跑全 0.00、隔离单跑测试 5/5 过)。修:user/sys 改形状检查,保留本钉主体断言 real ≥ 0.50s。

留给主会话的产品面发现(本 PR 不动产品):--init-file 对非交互脚本调用,GNU 5.3.20 不执行该文件(run_startup_files 仅交互分支执行 bashrc 文件,非交互只读 BASH_ENV;oracle 实测 value=),rubash 有意执行(main.rs 的 direct-run 扩展面,__RUBASH_SOURCED_RC 去重门)。这是产品政策分歧,按 #2190 约定转主会话改判,不在本簇处理。

验证:本地 8 条 time 相关钉全绿、debugger 钉无 starter 臂绿、shim fixture panic 消除且布局完整;bashdb 两条的行为断言需 CI 的真 fixture(autoconf 构建)裁定——以本 PR 的 Compatibility CLI tests job 为准。

Refs #2190
Refs #2192

ensure_bash_shim_fixture copied CARGO_BIN_EXE_bash unconditionally,
but the bash bin is feature-gated (Cargo.toml required-features =
["windows-shim"], default features empty), so the Linux cli lane
never builds it and the copy panicked at bashdb_compat.rs:61 —
the #2190 census failures. Fall back to the engine binary when the
shim path does not exist, and mirror the configure-time
/usr/local/bin layout inside the fixture root.

bash_compat_debugger_options_run_init_file_before_script asserted
an empty stderr unconditionally, which only holds where a bashdb
starter exists at a system prefix. The starter search is an
environment property (src/main.rs start_debugger; GNU shell.c:1547
start_debugger, diagnostic pair at shell.c:1556-1561): point
BASHDB_START_FILE at the lane fixture (target/bashdb-install) when
present, and assert GNU's diagnostic pair when no starter exists
anywhere. Oracle-verified against GNU bash 5.3.20.

Refs #2190
The two TIMEFORMAT pins demanded a literal %P of 0.00 and the
time -p pin demanded user/sys of exactly 0.00. GNU's print_time_info
(execute_cmd.c) measures RUSAGE_SELF + RUSAGE_CHILDREN deltas, so
%P for a sub-millisecond builtin is an unstable ratio — the GNU
5.3.20 oracle prints 1.00/2.00/87.00/90.00/91.00 for the very probe
the pin runs — and a spawned command's sys figure sits on the 5ms
rounding boundary (0.01 under load, 0.00 in isolated runs of both
shells). The product already implements GNU's model; the pins were
calibrated to constant zeros. Shape-check %P and user/sys, keep the
load-bearing assertions byte-strict (%R/%U/%S precision, %2lR long
form, %% literal, real >= 0.50s wall clock). Verified: oracle probes
plus repeated local runs; the format expansion itself is unchanged
and matches print_formatted_time (execute_cmd.c:1346).

Refs #2192
…nore nested-debug pin on measured engine stall

Debugger-options pin (CI round 1 falsification): pointing
BASHDB_START_FILE at the lane's real bashdb starter makes bashdb
actually start -- it stops at the script's first line, consumes the
command stream from stdin (EOF under the harness) and quits, so the
script never runs and the stdout expectation fails. Together with
the no-starter arm (GNU diagnostic pair on stderr, shell.c:
1556-1561) the old expectations were unsatisfiable in every
environment. The pin now writes its own minimal starter and asserts
both deterministic arms: starter seam sourced before the script
(init + starter values visible, clean stderr), and, where no system
starter exists, the exact diagnostic pair with env_remove on the
seam. Both arms verified byte-exact against the product binary.

Nested-debug pin: the shim fixture panic is fixed (sibling shim pin
passes CI), but the nested `debug` flow spends minutes inside
bashdb's _Dbg_shell_append_typesets typeset loop, whose
pipeline/read/comsub shape costs an order of magnitude more CPU
under rubash than under GNU bash (600-var verbatim loop: 5.07s user
vs oracle 0.31s). CI kills the pin at the 45.1s lane timeout; a
local full run takes 95s and the target output never appears.
Ignored with the measured reason, following this file's existing
stdin-loop ignores; the engine-side perf discovery is recorded in
the cluster report for the main session.

Refs #2190
@caomengxuan666

Copy link
Copy Markdown
Member Author

Round 2 (commit e253027) — dispositions after CI round 1 (run 41060329499):

Round 1 result: all jobs green except Compatibility CLI tests, which had exactly 2 failures left — the 3 TIMEFORMAT pins (#2192) and the shim pin bashdb_shell_nested_bash_uses_compatible_shim passed. The 2 remaining:

  1. bash_compat_debugger_options_run_init_file_before_script — round-1 starter arm falsified, pin redesigned. Pointing BASHDB_START_FILE at the lane's real bashdb starter makes bashdb actually start: it stops at the script's first line, consumes commands from stdin (EOF under the harness) and quits — the script never runs. Reproduced locally byte-shape-identically with a locally built bashdb 5.2 fixture. Together with the no-starter arm (GNU diagnostic pair, shell.c:1556-1561) the original expectations were unsatisfiable in every environment. The pin now writes its own minimal starter and asserts two deterministic arms: (A) starter seam sourced before the script — init + starter values visible, clean stderr; (B) seam removed via env_remove, and only where no system starter exists — exact diagnostic pair, script still runs. Both arms were verified byte-exact against the built product binary before pushing.

  2. bashdb_debug_nested_shell_preserves_typeset_array_quotes — ignored on measured product evidence. The fixture panic is fixed (sibling shim pin passes), but the nested debug flow spends minutes inside bashdb's _Dbg_shell_append_typesets typeset loop (typeset -p | while read … $(typeset -p $var) per session profile). That shape costs an order of magnitude more CPU under rubash than under GNU bash (600-var verbatim loop: 5.07s user vs oracle 0.31s user, same host). CI kills the pin at the 45.1s lane timeout; a local full run takes 95s and the target's output 42 never appears. Marked #[ignore] with the measured reason, following this file's existing stdin-loop ignores (2026-09-26). The engine-side perf discovery is in the cluster REPORT for the main session to file; no product code is changed by this PR.

Refs #2190, Refs #2192.

@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 30, 2026 13:51
@caomengxuan666
caomengxuan666 merged commit 2479975 into master Oct 30, 2026
11 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/census-2190-2192 branch October 30, 2026 13:51
caomengxuan666 added a commit that referenced this pull request Oct 30, 2026
Master carries PR #2218 (rubash#2211: comsub cd session-cwd anchoring, operand decline gates, logical_destination_display // seam fix in paths.rs), PR #2224 (census) and PR #2226 (walker) since this branch forked at 01836d3.

One conflict, in command_substitution_cd_pwd_output_impl (src/executor/command_substitution.rs), resolved as the union of both sides per the cluster REPORT overlap map:
- operand read stays quote-aware (split_shell_words_with_quote_info, #2219): the raw-empty decline is decided pre-expansion;
- #2211's post-expansion declines kept (leading '-', CDPATH search, expanded-empty) and operand_form is set only after every decline has passed;
- #2219's unquoted-blank (field-splitting) decline kept;
- downstream untouched: session-cwd anchoring (#2211), the cdable decline keyed on operand_form, and the #2220 logical rendering tail over paths.rs's seam-fixed logical_destination_display.

Re-verified on the merged tree (Linux): issue2219 9/9, issue2220 9/9 (incl. the //etc pin), issue2221 5/5, issue1415 adjacency 1/1, issue2211 14/14 (the session-// + relative-operand seam cells are pinned there), --lib 983 pass / 0 fail.
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