Repository navigation
Closed
Labels
Description
[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)。本轮三个输入:
- oil spec 补全(首轮 [Bug 批量·第三轮] oil spec 大规模差分: alias 展开语义/语法错误接受度/数组赋值族/算术错误码/jobs-dirs 内置 - 219+ 项差异(已跑 1/2 套件) #22 之后剩余文件,228 文件全量)
- mksh check.t(14526 行、数百块;
stdin:代码 stdin 重定向执行) - 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
heredoc系列:heredoc 边界/接收者差异(与 [Bug 批量] 命令替换状态污染 / heredoc / case 模式 / 参数替换 / 路径转换 / 重定向 / 调试钩子 - 20+ 个与 GNU Bash 的兼容性差异(含最小复现) #20 §2.1 家族相关,oil 用例更细:cat <<EOF内命令替换、<<-、多 heredoc)
1.3 eglob / extglob(mksh 侧也大量)
eglob-bad-*、eglob-infinite-plus、eglob-match-*:bash rc=2(语法错误)、rubash rc=0(静默接受)——extglob 语法错误处理([Bug 批量·第三轮] oil spec 大规模差分: alias 展开语义/语法错误接受度/数组赋值族/算术错误码/jobs-dirs 内置 - 219+ 项差异(已跑 1/2 套件) #22 语法宽松度家族)eglob-trim-3、eglob-utf8-1(rubash rc=1):extglob 匹配行为差异
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 项)
alias-1/2/9(bash rc=0 / rubash rc=127——alias 定义后使用失败)、alias-7/12(bash rc=2 语法错误 / rubash rc=0)、alias-8(bash rc=127 / rubash rc=0)——与 [Bug 批量·第三轮] oil spec 大规模差分: alias 展开语义/语法错误接受度/数组赋值族/算术错误码/jobs-dirs 内置 - 219+ 项差异(已跑 1/2 套件) #22 alias 家族一致
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 项)
heredoc-2/7/8/9/10(bash rc=0 / rubash rc=127)、heredoc-11(bash rc=2 / rubash rc=127)、heredoc-15(两侧 rc=0 输出不同)——heredoc 大块失败(rubash 的 heredoc 解析/执行与 bash 差异大,超出 [Bug 批量] 命令替换状态污染 / heredoc / case 模式 / 参数替换 / 路径转换 / 重定向 / 调试钩子 - 20+ 个与 GNU Bash 的兼容性差异(含最小复现) #20 §2.1 已知的「展开上下文」)
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 的关系
- 新领域(本轮):break/continue 越界错误被吞(rc=128 vs 0)、heredoc 大块失败(rc=127)、extglob 语法错误接受(eglob-*)、32 位整数边界、反斜杠续行处理、cd 历史
- 家族扩展:[Bug 批量·第三轮] oil spec 大规模差分: alias 展开语义/语法错误接受度/数组赋值族/算术错误码/jobs-dirs 内置 - 219+ 项差异(已跑 1/2 套件) #22 语法宽松度(eglob-bad、bksl-nl-ksh、array 空格)、[Bug 批量·第二轮] 花括号展开/IFS 分词/glob 路径分隔符/BASHPID/进程替换/coproc 挂起/wait 错误/特殊内建管道扩展 - 11 项新差异(全部经 GNU Bash 对照) #21 算术错误(ternary-prec、div-intmin)、[Bug 批量·第三轮] oil spec 大规模差分: alias 展开语义/语法错误接受度/数组赋值族/算术错误码/jobs-dirs 内置 - 219+ 项差异(已跑 1/2 套件) #22 alias(mksh 侧 12 项互证)
- ksh93 形态的数组语法是新证据:说明 winuxsh 对 ksh 兼容形态(
${x[0]、${a[0][0]})的解析失败
复现方式
# 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
caomengxuan666 commentedon Aug 3, 2026
完整结果(后台任务已完成)
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 快照未覆盖):
set -o/shopt 选项行为差异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 套件没有的):
2#110等 n#base 进制字面量——bash 报invalid number(rc=1),winuxsh 行为不同(多数 rc 差异)ksh93 tests(进行中,完成后追加)
复现与清单
结果:
spec-results.txt/mksh-results.txt/ksh93-results.txt;DIFF 行:diffs-full.txt/mksh-diffs-full.txt。caomengxuan666 commentedon Aug 3, 2026
ksh93 tests 完整结果(56 文件处理完)
PASS=10 / DIFF=46(共 56)。方法:为 ksh93 测试提供 bash/winuxsh 双兼容
_common(err_exit/print/integer/whence),对比退出码(= 测试文件错误数)。真差异(bash 错误数低、winuxsh 高——winuxsh 在这些 bash 能跑的测试上大量失败)
代表形态(
arrays2.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 也无法正常跑,差分无法归因。结论
${a[0][0]}、${p.len})在 winuxsh 下大量失败——ksh 兼容层是独立缺口(mksh 的 integer-base/复合变量同族)$LINENO在[[ ]]内的展开错误与 mkshlineno用例互证完整清单:
scripts/probe/suites/ksh93-diffs.txt(46 项,含两侧错误数)。caomengxuan666 commentedon Aug 3, 2026
更正说明(2026-08-03)
此前评论中「ksh 兼容层是独立缺口」的表述不准确,予以更正:
${a[0][0]}、${p.len})是 ksh 特有语法,GNU bash 本身不支持——rubash 的兼容目标是 bash,这部分差异不是缺口,无需修复n#base进制字面量($((16#ff)))、$LINENO在[[ ]]内的展开、alias/case/heredoc/quoting 等通用语义docs/bash-compat-issues.md(排除项一节)caomengxuan666 commentedon Aug 12, 2026
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 全量不声明完成。
caomengxuan666 commentedon Aug 12, 2026
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 启动方式。
caomengxuan666 commentedon Aug 12, 2026
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。
arookieofc commentedon Aug 13, 2026
修复进展:jobs/wait 根因切片已修复。
wait -n回收的子进程状态现在会保留,后续显式wait PID可再次取得 Bash 兼容的退出码;新增 part_036 回归测试。验证:cargo test --test executor_tests command_chaining::part_036,27/27 通过。完整 oil/mksh 套件仍有其他未归因差异,本 issue 暂不关闭。arookieofc commentedon Aug 14, 2026
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).
arookieofc commentedon Aug 14, 2026
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.
arookieofc commentedon Aug 14, 2026
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.
arookieofc commentedon Aug 16, 2026
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.
caomengxuan666 commentedon Aug 28, 2026
关闭说明
mksh/ksh93 可执行文件不可用,测试无法运行。oil spec 同 #22。基础设施问题已在 #40/#41/#42 中逐项跟踪。关闭历史 issue。