Skip to content

fix(executor): decode the :? diagnostic message through the visible-text face (Refs #3260) - #3462

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/3260-colon-question-diag-carrier
Nov 15, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/3260-colon-question-diag-carrier

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

根因

${q:?...} 诊断消息词经 expand_parameter_word 后带 IFS_GLUE(\x1c)载体直接印出,未过法定解码面;两处 :? 诊断构造点(pre-scan 臂 parameter_errors.rs 与双引号/prompt-pass 臂 embedded_parameters.rs)现统一过 locale::decode_to_visible_text。

GNU 锚点

subst.c:8216 parameter_brace_expand_error:expand_string 展开消息词(含 quote removal),report_error("%s: %s") 报纯文本。消息是 display text,不是 value;值位(如 :-)不动,IFS_GLUE 载体仍保留(guard 钉 value_context_glue_preserved,rubash#212)。

验证(Simular box,cargo 1.99.1,-j 1)

  • GNU oracle(本地 bash 5.3.20,脚本文件):probe3260.sh 12 形全对(c02 $"e f" GNU 原样输出 $"e f",base 已对,非修法面)
  • 钉 fail-first(base e50cea9):4 passed / 7 failed(7 格皆 dq/sq span 形)
  • 钉 head:11 passed / 0 failed
  • lib 双边:base 1246 passed / 0 failed / 4 ignored;head 1246 passed / 0 failed / 4 ignored(逐数同)
  • RUSTFLAGS="-D warnings" cargo check --locked --lib --bins:0 error
  • hygiene:cargo fmt --check / check-marker-literals.py / check-utf8-boundary-hygiene.sh 均 rc=0
  • codegraph 本轮不可用(索引 DB disk I/O error,本地写墙所致);构造点普查改用 rg 交叉核对:expand_parameter_word 仅两处喂 :? 诊断,余下调用点均为值位/非诊断面

本 PR 删除了什么

无。纯加法修法:两处构造点各包一层 decode_to_visible_text;无删除、无重命名、无公开面变化。

UNVERIFIED-BY-CAPTAIN

…ext face (Refs #3260)

Root cause: `${q:?...}` diagnostic message words keep quoted
whitespace behind the IFS_GLUE carrier (\x1c) for field splitting;
both `:?` diagnostic construction points printed the
`expand_parameter_word` result raw, so the carrier leaked into the
diagnostic (`q: e\x1c f`).

GNU anchor: subst.c:8216 parameter_brace_expand_error expands the
message word (expand_string, quote removal included) and reports the
plain text via report_error("%s: %s"). The message is display text,
not a value, so both construction points now pass the expanded word
through the sanctioned visible-text face
(locale::decode_to_visible_text): the pre-scan arm in
parameter_errors.rs and the double-quoted/prompt-pass arm in
embedded_parameters.rs. Value positions (e.g. `:-`) are untouched -
the IFS_GLUE carrier still survives there (guard nail
value_context_glue_preserved, rubash#212).

Regression nails: tests/issue3260_colon_question_diag_carrier.rs,
11 cells (dq/sq/tab/non-colon/nested/pipeline/heredoc/unquoted
control/empty default/value-in-quotes/value-context guard), all
expectations verified against GNU bash 5.3.20 script-file runs.

本 PR 删除了什么:无。纯加法修法:两处构造点各包一层
decode_to_visible_text;无删除、无重命名、无公开面变化。

UNVERIFIED-BY-CAPTAIN
@caomengxuan666

Copy link
Copy Markdown
Member Author

【WIN-AGENT-AUDIT】

PR #3462 第1轮 — 建议:PASS
head: e064a1d base(merge-base): e50cea9 文件: 3 个 +163/-2
关联 issue: #3260(状态:open,我核过的时间:本地当前;本 PR 无先验评论)

机制核查:

  • 根因正确::?/? 诊断消息词经 expand_parameter_word 展开后,引号内空白仍由 IFS_GLUE 载体(\x1c)承载供字段分割用,而诊断是显示文本——直接把载体字节打进 stderr(q: e\x1c f)。GNU subst.c:8216 parameter_brace_expand_error 对消息词走 expand_string(含去引号)后报告纯文本。修复在两个 :? 臂(embedded_parameters.rs:900 区 / parameter_errors.rs:2690 区)对展开结果过 sanctioned 的 locale::decode_to_visible_text 再打印;decoder 有既有单测覆盖载体→可见字节映射(locale.rs:1071)。值上下文不受影响(钉中 value_context_glue_preserved 守 :- 数组单元素语义,对应 [bug] Quoted alternate value ${v:-"a b"} over-splits in assignment context (GNU: 1 element, rubash: 2) #212 面)。
  • 无关改动:无。

腿(逐项):

  • 钉自跑:issue3260_colon_question_diag_carrier 11/0(head,Windows 全绿)。
  • fail-first:base e50cea9 放同钉 → 4 passed / 7 failed,红集={double_quoted_span_space, double_quoted_span_tab, heredoc_body, nested_expansion, non_colon_question, pipeline_element, single_quoted_span},base stderr 实见 q: e\u{1c} f 载体泄漏——与 PR 声称的 7 个载体形状一致;4 个控制格(unquoted/empty/expand/valuectx)在 base 即绿(非本次面),合理。
  • lib 双边:head 失败名集 {issue2084_session_end_restores_host_process_state} / base 同集 / 差集 ∅。
  • -D warnings:lib check 干净 0 警告。
  • 卫生:rustfmt --check 三文件 FMT-OK;marker-lint OK(117 consts);utf8-boundary clean。
  • CI:本 head 的 run 全部 pass(API ledger / compat CLI / cross-target×2 / GNU goldens / Rust tests / macOS / shell tests / Windows compile / niubash build 全绿)——钉 11 格已在 Linux CI 实跑通过。
  • GNU 对照:WSL GNU bash 5.3.20(1)(/usr/local/bin/bash,脚本文件 LF)。11 格逐格复跑:${q:?"e f"}/'e f'/${q?"e f"}/unquoted 均 q: e f rc=1;tab 格 q: e\tf;"e $v f"(v=W) q: e W f;管道格 ... | cat 报 q: e f 且 rc=0(末元素状态);heredoc 格 line 2 q: e f rc=1;${q:?} q: parameter null or not set;值上下文 a=(${v:-"e f"}) → ${#a[@]}=1——全部与钉断言吻合。脚本:target/probes-3462/oracle.sh。

F 点:无。

续作记录:未动代码。

未跑/VOID 的腿:无。

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