Skip to content

[Bug 批量·第四轮] 三套件差分: oil spec 补全(427+ DIFF)/mksh check.t(153+ DIFF)/ksh93 tests - alias/数组/算术/heredoc/eglob/expand/错误码(后台全量继续中) #23

Closed

Description

@caomengxuan666

[Bug 批量·第四轮] 三套件差分: oil spec 补全(427+ DIFF) / mksh check.t(153+ DIFF) / ksh93 tests —— 覆盖 alias/数组/算术/heredoc/eglob/expand/内置错误码

方法

继续差分测试(GNU Bash 5.2 Git Bash 为基准 vs winuxsh 0.10.2,逐字节对比 stdout+rc)。本轮三个输入:

  1. oil spec 补全(首轮 [Bug 批量·第三轮] oil spec 大规模差分: alias 展开语义/语法错误接受度/数组赋值族/算术错误码/jobs-dirs 内置 - 219+ 项差异(已跑 1/2 套件) #22 之后剩余文件,228 文件全量)
  2. mksh check.t(14526 行、数百块;stdin: 代码 stdin 重定向执行)
  3. ksh93 tests(58 文件;提供双兼容 _common,对比退出码=错误数)

驱动:scripts/probe/suites/spec-difftest.sh / mksh-difftest.sh / ksh93-difftest.sh。完整清单:spec-results.txt / mksh-results.txt / ksh93-results.txt(后台全量运行中,本文为已完成部分快照,完成后的完整清单会追加)。

一、oil spec 补全(累计 427+ DIFF)

在 #22 已列主题(alias/数组赋值族/算术错误/jobs/dirs/brace)之外,新覆盖文件与代表差异:

1.1 case 语句

  • case.test.sh 系列:case 模式匹配差异(hello: command not found 出现在用例输出——模式匹配失败导致执行体错误执行)

1.2 heredoc

1.3 eglob / extglob(mksh 侧也大量)

1.4 expand 系列

  • expand-weird-1(rubash rc=111)、expand-unglob-*(rc=1)、expand-slashes-*(rc=127/1)、expand-bang-2(bash rc=1 / rubash rc=0):参数展开边界
  • bksl-nl-*(反斜杠续行):bksl-nl-7/8(bash rc=0 / rubash rc=127)、bksl-nl-ksh-1/2(bash rc=2 语法错误 / rubash rc=0)

1.5 break/continue 越界

  • break-5 / continue-5:bash rc=128(bash: break: only meaningful in a loop)、rubash rc=0(静默)——非法 break/continue 被吞

1.6 其他新文件

  • arith 补充:arith-divnull、arith-div-byzero(rubash rc=127)、arith-mandatory(rubash rc=2)、arith-lazy-4(rc=1)
  • background:wait -n、jobs -p 错误码
  • bool-parse:test 内置 ( = ) 解析
  • builtin-echo:typed args(bash rc=2 / rubash rc=0)、\0377 八进制边界
  • bugs:readonly 赋值错误被吞(bash rc=1 / rubash rc=0)
  • cd 系列:cd-history(bash rc=2 / rubash rc=127)、cd-pe

二、mksh check.t(153+ DIFF,块覆盖到 heredoc)

2.1 alias(12 项)

2.2 arith(15 项)

  • arith-divnull、arith-prec-1(两侧 rc=0 输出不同)、arith-ternary-prec-1(bash rc=1 / rubash rc=0)、arith-div-intmin-by-minusone(bash rc=1 / rubash rc=0——除 INT_MIN/-1 错误被吞)、arith-unsigned-1(rubash rc=1)、arith-limit32-1(两侧 rc=0 输出不同——32 位整数边界)

2.3 expand/glob/eglob(35 项)

  • 见 1.3/1.4(同族)

2.4 heredoc(12 项)

2.5 其他

  • bksl-nl-*(反斜杠续行)、break-5/continue-5(rc=128 vs 0)、cd-history、selftest-exec(rubash rc=127)、expand-weird-1(rc=111)

三、ksh93 tests(初步, 进行中)

  • arith.sh:bash 错误数 2 / rubash 127(整个测试文件跑挂)
  • arrays.sh / arrays2.sh:大量 ${x[0] 类 FAIL——数组索引/切片在 ksh93 测试形态下大量失败(winuxsh 对 ksh 风格数组语法处理异常,含 [[ ]] 内 $LINENO 展开错误)
  • 完整 58 文件结果后台跑完后补充

与既有 ISSUE 的关系

复现方式

# winuxsh 仓库 scripts/probe/suites/ 下
bash spec-difftest.sh                     # oil spec 全量
bash mksh-difftest.sh                     # mksh check.t
bash ksh93-difftest.sh                    # ksh93 tests (需 Git Bash, 慢)

结果文件:spec-results.txt / mksh-results.txt / ksh93-results.txt(DIFF 行提取:grep -a '\[DIFF\]')。

Activity

  1. caomengxuan666 commented on Aug 3, 2026

    @caomengxuan666
    MemberAuthor

    完整结果(后台任务已完成)

    oil spec 全量(PASS=1083 / DIFF=684 / 共 1767 用例处理)

    按 spec 文件 DIFF 数量统计(前 35):
    word-split 35、sh-options 23、array-sparse 21、builtin-trap-err 20、builtin-umask 18、background 18、builtin-trap 17、array 17、parse-errors 16、brace-expansion 16、alias 16、command-sub 15、builtin-kill 15、var-op-test 14、builtin-dirs 14、arith 14、var-sub-quote 13、redirect-multi 12、builtin-set 12、builtin-process 12、builtin-echo 12、var-op-slice 11、nameref 11、errexit-osh 11、builtin-cd 11、var-op-patsub 10、toysh-posix 10、redirect-command 10、loop 10、extglob-match 10、bugs 9、serialize 9、ble-idioms 9、shell-grammar 8、pipeline 8(完整清单:winuxsh 仓库 scripts/probe/suites/diffs-full.txt)

    相对快照版新增的高频领域(#23 快照未覆盖):

    mksh check.t 全量(PASS=183 / DIFF=436 / 共 627 块)

    按名称前缀统计(前 30):
    regression 31、integer-base-one 19、better-parens 13、alias 12、heredoc 10、heredoc-tmpfile 8、bashiop 8、arrays 8、oksh-seterror 7、comsub 7、wcswidth 6、integer-base 6、exit-err 6、echo-test 6、varexpand-substr 5、lineno 5、xxx-variable-syntax 4、utf 4、print 4、nameref 4、integer-base-err 4、history-subst 4、heredoc-comsub 4、exit-trap 4、eglob-substrpl 4、debian 4、command 4、arith 4、varexpand-special 3、varexpand-null 3(完整清单:scripts/probe/suites/mksh-diffs-full.txt)

    mksh 专属新领域(oil 套件没有的):

    ksh93 tests(进行中,完成后追加)

    复现与清单

    # winuxsh 仓库 scripts/probe/suites/ 下
    bash spec-difftest.sh   # oil: PASS=1083 DIFF=684
    bash mksh-difftest.sh   # mksh: PASS=183 DIFF=436
    bash ksh93-difftest.sh  # ksh93: 58 文件(慢)

    结果:spec-results.txt / mksh-results.txt / ksh93-results.txt;DIFF 行:diffs-full.txt / mksh-diffs-full.txt。

  2. caomengxuan666 commented on Aug 3, 2026

    @caomengxuan666
    MemberAuthor

    ksh93 tests 完整结果(56 文件处理完)

    PASS=10 / DIFF=46(共 56)。方法:为 ksh93 测试提供 bash/winuxsh 双兼容 _common(err_exit/print/integer/whence),对比退出码(= 测试文件错误数)。

    真差异(bash 错误数低、winuxsh 高——winuxsh 在这些 bash 能跑的测试上大量失败)

    文件 bash 错误数 winuxsh 错误数
    case.sh 7 53
    alias.sh 31 36
    append.sh 2 15
    attributes.sh 2 124(几乎全挂)
    comvar.sh 2 124
    arrays2.sh 2 124
    variables.sh 2 高
    substring.sh / types.sh / math.sh / expand.sh / quoting.sh 低 高

    代表形态(arrays2.sh 输出):

    FAIL: ${a[0][0]} != 00    # ksh 风格多维数组索引
    FAIL: ${x[0] is not element 0   # [[ ]] 内 $LINENO 展开错误
    FAIL: readonly attribute fails / integer base 8 fails   # attributes.sh
    

    噪音(bash 错误数也高 = ksh 特有语法, bash 自身跑不动, 不作为 winuxsh 归因)

    builtins.sh(bash=125)、comvario.sh(124)、coprocess.sh(124)、pty.sh、libcmd.sh、readcsv.sh 等——这些文件大量使用 ksh 特有语法(whence/print/复合变量),bash 5.2 也无法正常跑,差分无法归因。

    结论

    • ksh93 形态的复合变量/多维数组(${a[0][0]}、${p.len})在 winuxsh 下大量失败——ksh 兼容层是独立缺口(mksh 的 integer-base/复合变量同族)
    • $LINENO 在 [[ ]] 内的展开错误与 mksh lineno 用例互证
    • 其余与既有家族一致(alias/heredoc/glob/quoting/subshell)

    完整清单:scripts/probe/suites/ksh93-diffs.txt(46 项,含两侧错误数)。

  3. caomengxuan666 commented on Aug 3, 2026

    @caomengxuan666
    MemberAuthor

    更正说明(2026-08-03)

    此前评论中「ksh 兼容层是独立缺口」的表述不准确,予以更正:

    • ksh93 测试中的复合变量/多维数组(${a[0][0]}、${p.len})是 ksh 特有语法,GNU bash 本身不支持——rubash 的兼容目标是 bash,这部分差异不是缺口,无需修复
    • 真差异仅限 bash 也支持的子集:如 n#base 进制字面量($((16#ff)))、$LINENO 在 [[ ]] 内的展开、alias/case/heredoc/quoting 等通用语义
    • 完整说明已同步到 rubash 仓库 docs/bash-compat-issues.md(排除项一节)
  4. caomengxuan666 commented on Aug 12, 2026

    @caomengxuan666
    MemberAuthor

    2026-08-12 update: mksh check.t 不能继续无界跑。用 mksh 官方 check.pl 指向 rubash 时,harness 已经进入实际用例,但一个 rubash-under-test.exe 子进程挂住;这次暴露出 SIGKILL 对带 mailbox 的 rubash 子进程无效。已提交 47924f4 修复 SIGKILL 强杀路径。后续 mksh 需要改为按 test name/分片加 timeout 跑,不能再整套无界跑;当前 mksh 全量不声明完成。

  5. caomengxuan666 commented on Aug 12, 2026

    @caomengxuan666
    MemberAuthor

    2026-08-12 update: mksh check.t 已用官方 check.pl 加 -t 10 单测 timeout 跑完。结果:Total passed 162;Total failed 417(5 ignored,412 unexpected)。日志:target/issue-suites/results/mksh-check-timeout.log。ksh93 尚未有效启动:当前 checkout sparse 展开后,bin/package 在 Git Bash /d/... 路径下报 “must be in the package root directory tree”,需要改用它认可的路径环境或单独修 harness 启动方式。

  6. caomengxuan666 commented on Aug 12, 2026

    @caomengxuan666
    MemberAuthor

    2026-08-12 update: ksh93 diff wrapper 已完成一轮等价跑法(不依赖构建 ksh,自定义 bash/rubash 双兼容 _common,逐文件比较错误数 rc;结果见 target/issue-suites/results/ksh93-diff/results.tsv)。结果:TOTAL=56,PASS=25,DIFF=31。高信号 rubash 失败集中在 arith.sh 2→127、attributes.sh 2→125、case.sh 7→40、heredoc.sh 24→127、jobs.sh 2→10、path.sh 1→103、quoting.sh 51→125、quoting2.sh 2→65、statics/subshell/substring 均 2→127。注意:ksh93 文件含 enum、compound vars、.sh.*、typed attrs 等 ksh-only 噪音;只把 Bash 可运行子集的 sharp regression 作为 rubash 缺口。实现归因:redirection/fd/device、heredoc、parser strictness、arithmetic errors、alias/hash、word expansion、jobs/coproc、builtin parity。已整理本地汇总:target/issue-suites/results/issue-suite-summary.md。

  7. arookieofc commented on Aug 13, 2026

    @arookieofc
    Member

    修复进展:jobs/wait 根因切片已修复。wait -n 回收的子进程状态现在会保留,后续显式 wait PID 可再次取得 Bash 兼容的退出码;新增 part_036 回归测试。验证:cargo test --test executor_tests command_chaining::part_036,27/27 通过。完整 oil/mksh 套件仍有其他未归因差异,本 issue 暂不关闭。

  8. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Follow-up fix in commit e0242d2: direct GNU Bash 5.2 probes show out-of-loop break/continue emit the diagnostic but leave $? at 0 when the command list continues. Rubash now matches this behavior; part_050 regression tests were corrected and pass (14/14).

  9. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit aee928d. Alias expansion is now gated by the expand_aliases shopt state across simple, reparsed, and compound paths. Fatal arithmetic expansion errors now stop the command list with status 1. Focused regressions pass.

  10. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    2026-08-14 follow-up: fixed the shared associative-subscript and conditional grammar roots that affected the executor compatibility slice. Verification: executor 1523/1523, with the broader oil/mksh/ksh suite still requiring independent differential verification.

  11. arookieofc commented on Aug 16, 2026

    @arookieofc
    Member

    2026-08-17 follow-up: commit d68d8b9 fixes the bridge-free malformed arithmetic-for parameter-header acceptance primitive. Bash/Rubash status now matches (2), with focused CLI 3/3, parser 4/4, lib 200/200. Raw evidence: target/issue-suites/results/native-bash-20260817-arith-for/. The aggregate Oil/mksh/ksh compatibility scope remains open.

  12. caomengxuan666 commented on Aug 28, 2026

    @caomengxuan666
    MemberAuthor

    关闭说明

    mksh/ksh93 可执行文件不可用,测试无法运行。oil spec 同 #22。基础设施问题已在 #40/#41/#42 中逐项跟踪。关闭历史 issue。

  13. added
    bug
    gnu-baseline
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions