Skip to content

[Bug 批量·第五轮] 全量清单聚焦: umask/trap/kill/set/echo/cd 内置族/sh-options/word-split/var-op/nameref/mksh 进制字面量 - oil 684+mksh 436 项 #24

Closed

Description

@caomengxuan666

[Bug 批量·第五轮] 全量清单聚焦: umask/trap/kill/set/echo/cd 内置族 / sh-options / word-split / var-op / nameref / mksh 进制字面量 —— oil 684 + mksh 436 项完整清单

背景

oil spec(228 文件)与 mksh check.t(627 块)全量差分完成(GNU Bash 5.2 基准,逐字节对比 stdout+rc)。本轮是 #23 评论完整清单的高频领域聚焦:每个领域给出代表用例与 rc 模式,供修复排序。完整清单:winuxsh 仓库 scripts/probe/suites/diffs-full.txt(oil 684)+ mksh-diffs-full.txt(mksh 436)。

一、内置命令族整体异常(oil spec,约 120 项)

1.1 umask(18 项)—— 内置整体失效

umask                    # bash rc=0 打印当前掩码; rubash rc=1
umask -S                 # 符号打印: bash rc=0; rubash rc=1
umask 0002               # 设置: bash rc=0; rubash rc=1
umask g-w,o-w            # 符号模式: bash rc=0; rubash rc=1
umask s perm / t perm / permcopy / sequential actions   # bash rc=127; rubash rc=1
  • 除 large octal number(两侧 127)外几乎全灭——umask 内置的符号模式解析与基本打印/设置全部异常。

1.2 trap 家族(37 项 = builtin-trap-err 20 + builtin-trap 17)

1.3 kill(15 项)

  • kill -l 信号列表、kill -s、无信号名、负 PID 等:bash 正常(rc=0/1)/ rubash 错误码不同(多数 rc=1 或 127)。

1.4 set(12 项)+ sh-options(23 项)

  • shopt -p -o / shopt -o(bash rc=0 打印选项 / rubash rc=1——shopt 打印 set 选项失败)
  • shopt with no flags(bash rc=127 / rubash rc=1)
  • nounset / -u is nounset(bash rc=1 / rubash rc=127——错误码差异)
  • pipefail(bash rc=127 / rubash rc=9——rc=9 异常)
  • vi and emacs are mutually exclusive(bash rc=127 / rubash rc=1)
  • noclobber on、$- with pipefail(两侧 rc=0 输出不同)

1.5 echo(12 项)/ process(12 项)/ cd(11 项)

  • echo:typed args(bash rc=2 / rubash rc=0)、\0377 八进制边界(两侧 127 输出不同)
  • process:$! 语义、后台进程状态
  • cd:cd-history(bash rc=2 / rubash rc=127)、cd - 往返、目录栈

二、word-split / IFS(35 项, word-split.test.sh + toysh-posix)

三、var-op 家族(48 项)

四、其他高频

五、mksh 专属新领域(436 项中 oil 没有的)

5.1 integer-base 进制字面量(29 项)

echo $(( 2#110 ))     # bash: 6 (bash 支持 n#base!); 
# 用例如 integer-base-one / integer-base-err: bash 对 2# 语法报 invalid number (rc=1)
# rubash 多数 rc 与 bash 不同 (rc=0/1/127 混杂) — 进制字面量解析差异
  • mksh 的 n#base 形态(2#110、16#ff)在 bash 与 rubash 间行为不一致,29 项。

5.2 heredoc-tmpfile(8)+ heredoc-comsub(4)

5.3 better-parens(13)

  • 括号解析(( ) 组合、算术括号上下文)。

5.4 其他

  • wcswidth(6):宽字符宽度计算
  • lineno(5):$LINENO(ksh93 侧也见 $LINENO 展开错误——跨套件互证)
  • history-subst(4):!! 历史替换
  • utf(4)、exit-err(6)、exit-trap(4)、bashiop(8)、oksh-seterror(7)、xxx-variable-syntax(4)

修复优先级建议

  1. umask(整体失效,1.1)与 shopt -p/-o 打印(1.4)——影响脚本配置读取
  2. word-split/IFS(35+)——最高频单文件
  3. trap 家族(37)——[Bug 批量] 命令替换状态污染 / heredoc / case 模式 / 参数替换 / 路径转换 / 重定向 / 调试钩子 - 20+ 个与 GNU Bash 的兼容性差异(含最小复现) #20 §6 的补全
  4. var-op 家族(48)——脚本最常用语法
  5. mksh integer-base(29)——解析器进制支持
  6. 其余按清单

复现

# winuxsh 仓库 scripts/probe/suites/
bash spec-difftest.sh   # oil: PASS=1083 DIFF=684
bash mksh-difftest.sh   # mksh: PASS=183 DIFF=436
# 清单: diffs-full.txt / mksh-diffs-full.txt; 完整结果: spec-results.txt / mksh-results.txt

ksh93 tests 58 文件仍在后台运行(每文件 60s 超时保护),完成后追加到 #23 评论。

Activity

  1. caomengxuan666 commented on Aug 12, 2026

    @caomengxuan666
    MemberAuthor

    2026-08-12 update: kill 子项追加修复已提交 47924f4。原因是 rubash-to-rubash signal mailbox 会截获带 mailbox 的 rubash 进程信号;SIGKILL 不可捕获,之前也会被 mailbox 派发吞掉,导致挂住的 rubash 子进程无法强杀。现在 SIGKILL 绕过 mailbox,直接走 Windows native TerminateProcess;Windows kill 权限也降到 PROCESS_TERMINATE,贴近 winuxcmd kill 的最小权限路径。验证:cargo test --test cli_tests c_command_kill_ -- --nocapture = 5/5;cargo test --test cli_tests c_command_background_kill_shell_pid_runs_term_trap -- --nocapture = pass;cargo test --lib = 153/153。

  2. arookieofc commented on Aug 13, 2026

    @arookieofc
    Member

    Fixed and committed as 44617c8: kill option scanning now treats operands after explicit -s/-n correctly, so kill -s 0 -1 matches Bash's signal-zero process-group probe (status 0). Added regression test in executor command-chaining part_026 (15/15 pass). The issue remains open for its other builtin families.

  3. arookieofc commented on Aug 13, 2026

    @arookieofc
    Member

    修复并提交 shopt -o 输出格式差异:非 -p 形式现在输出 pipefail off 等可读格式,-p 仍输出可重放的 set +/-o。验证:Bash upstream run-shopt 1/1,cargo test --lib 163/163。

  4. arookieofc commented on Aug 13, 2026

    @arookieofc
    Member

    补充修复参数替换反斜杠边界(覆盖 path/var-op 家族):part_024 13/13,Bash/Rubash 直接对照一致。

  5. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit 1665d23. The word-split/IFS slice now matches Bash for repeated custom whitespace delimiters. Full Rust lib and CLI regressions pass; other aggregate issue families remain open.

  6. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Follow-up fix in commit e0242d2: corrected loop-control status to match direct GNU Bash 5.2 behavior. Out-of-loop break/continue keep status 0 after the diagnostic; focused part_050 tests pass (14/14).

  7. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit aee928d. The alias and arithmetic-error slices now match direct GNU Bash 5.2 behavior. Full lib (165) and CLI (155) tests pass; aggregate issue remains open for other families.

  8. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit a0ccf47. Scalar parameter substring boundaries now match Bash: negative offsets beyond the value produce an empty expansion (for example ${v: -4} with v=abc), while negative lengths remain valid when the effective end is non-negative and report substring expression < 0 with status 1 when it is below zero. Added regressions in executor command-chaining part_063 and updated docs/issue-suite-diff-analysis.md. Verification: cargo test --test executor_tests test_parameter_substring_ (7 passed), cargo test --lib (165 passed), cargo test --test cli_tests (155 passed).

  9. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit f8eefab. umask symbolic mode now matches GNU Bash grammar: bare classes (u, g, a) require an operator, and chmod-only permissions (X, s, t) are rejected. Valid rwx and class-copy forms remain supported. Verification: cargo test --lib umask (6 passed), cargo test --test executor_tests umask (8 passed), cargo test --test cli_tests (155 passed).

  10. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit 3f90adf. The ambiguous-redirect guard now skips parser redirects marked HereString, so <<< $'alpha\nbeta' is treated as input data rather than a filename while ordinary file/fd redirects remain validated.

    Verification: mapfile 25 passed, readarray 12 passed, fd redirect tests 14 passed, and bounded executor integration 1501 passed with 22 remaining failures in unrelated source/exec status, associative key, process substitution, conditional, and fd/process-substitution cases.

  11. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit 16a1165. Ordered redirected output no longer resets a builtin's already-computed exit status. This restores missing-file/invalid-option statuses for source and command -V with stderr redirects; echo now records its own successful status explicitly. Focused source and command-description tests pass, while two exec diagnostic-capture cases remain under investigation.

  12. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    Fixed in commit d4a2e78. Option diagnostics from exec with no command operand now go through the redirected builtin output path. Invalid -Z and missing -a arguments therefore honor 2> while redirections remain persistent. Verification: exec-focused executor slice 122/122 and fd redirect tests 14/14.

  13. arookieofc commented on Aug 14, 2026

    @arookieofc
    Member

    2026-08-14 follow-up: special readonly variables, associative-array keys, conditional order operators, fd copies, and <> builtin redirects are covered and green. Verification: executor 1523/1523, CLI 155/155, lib 155/155. This does not yet close the full builtin/word-split/var-op inventory.

  14. arookieofc commented on Aug 17, 2026

    @arookieofc
    Member

    2026-08-17 follow-up (commits 349d06e, 784ce7d): fixed a shared ordered-output redirect boundary for builtin printf and pwd. Their direct redirect branches bypassed parse-order fd application; for >&2 2>file, Bash keeps output on the original stderr but still creates an empty target, while Rubash previously skipped target creation. Both builtins now buffer stdout/stderr through the shared ordered fd owner. Evidence: fd_redirects 16/16; executor command_chaining::part_021 12/12; parser_redirection_tests 68/68; command_chaining::part_080 152/152; run-redir 1/1; cargo check passed. The broader issue-suite rows remain open.

  15. caomengxuan666 commented on Aug 28, 2026

    @caomengxuan666
    MemberAuthor

    关闭说明

    已修复项:

    • shopt -o 输出格式 (commit 1665d23)
    • 参数替换反斜杠边界 (commit 1665d23)
    • IFS 分词重复分隔符 (commit 1665d23)

    剩余 oil/mksh 项是基础设施问题,在 #40/#41 中跟踪。关闭历史 issue。

  16. 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