Skip to content

[bug] $- 字母完整性残余:m(monitor)从不渲染且 -m invocation 被当脚本名;H(histexpand)在 -i -c / -i file / -i -s 三路径缺失 #151

Closed

Description

@caomengxuan666

来源

#149 修复(3bff4dd8)的八模式矩阵排查中按"不顺带修"纪律单独记录的两个既有缺口。

现象

  1. m 永不渲染:set -m / set -o monitor 后 GNU $- 含 m(flags.c:242 直置 jobs_m_flag;交互默认经 jobs.c:4869 change_flag),rubash 的 shell_option_flags 表无 ('m', "monitor") 条目。另 invocation 层 rubash -m -c 把 -m 当脚本名(main.rs cli_shell_flag_name 无 m;GNU 无 tty 时 -m 反而无 m,语义见 flags.c/jobs.c)。
  2. H 三路径缺失:-i -c / -i file / -i -s 下 GNU $- 含 H(init_interactive 总置 histexpand,shell.c:1830-1842),rubash 只有交互无参回落路径执行 prepare_interactive_history(script_driver.rs:1010-1014 一带)。

期望

$- 按 which_set_flags(flags.c:294)表序完整渲染 m/H;-m invocation 正确入 cli_shell_flag_name 并对齐 GNU 的无 tty 行为。

关联

Activity

  1. added
    bug
    on Sep 26, 2026
  2. caomengxuan666 commented on Sep 26, 2026

    @caomengxuan666
    MemberAuthor

    已在 wt/c-diag 分支修复(commit f4f6cf58,基线 8f89767):

    • (a) prompt_expansion.rs shell_option_flags 表在 k/n 之间加 ('m', "monitor")(flags.c:177 表位);set -m; echo $- → hmBc。
    • (b) main.rs cli_shell_flag_name 接受 -m;新增 apply_startup_job_control 移植 jobs.c:4869 change_flag('m', job_control ? '-' : '+'):非交互且 stderr 非 tty 时按 GNU 打两条诊断(cannot set terminal process group / no job control in this shell)并从 $- 摘掉 m;交互则保留/置上 m。
    • (c) prepare_interactive_history 从“仅无参回落”移入全部四条 run_*_with_init 派发路径(-c / 脚本 / -s / 无参),且移到 init file 之后(对齐 shell.c:799-811 次序),-i -c / -i file / -i -s 三路径 $- 均含 H。

    八模式矩阵双侧逐字母一致(target/issue-suites/results/151/matrix151.sh、m-gnu.txt、m-rub.txt):m1 hBc / m2 himBHc / m3 hB / m4 himBH / m5 hBs / m6 himBHs / m7 两诊断+hBc / m8 hmBc。m7 stderr 与 GNU 一致(pid 与 shell 路径前缀归一化后)。注意:m7 在 rubash 父进程管道下子进程 stderr 会被父进程延后转发(顺序倒置)——直接调用顺序正确;这是既有的子进程 stderr 转发机制行为,与本修复无关(另见 #164)。

    四门:build 0 警告 / lib 453 全绿 / cargo check --tests 0 警告 / 两个文件 rustfmt 干净。

  3. caomengxuan666 commented on Sep 26, 2026

    @caomengxuan666
    MemberAuthor

    已在 3386013 落地(f4f6cf58):$- 表加 ('m', monitor)(flags.c:177 位序 k/n 之间);cli_shell_flag_name 接受 -m + apply_startup_job_control 移植 jobs.c:4869 change_flag 语义(非交互且 stderr 非 tty → 打 GNU 两条诊断 jobs.c:4841/4853/:4856 并摘 m;交互 → 置 m);prepare_interactive_history 移入 -c/脚本/-s/无参四路径(shell.c:799-811 次序)→ H 三路径齐。八模式矩阵双侧逐字母全同(产物 results/151/)。474/474 + 双交叉干净。

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions