Repository navigation
cold-path diagnostic prefixes derive from the argv[0] carrier chain (Refs #2791, #3193 census) - #3247
Merged
Merged
Conversation
added 2 commits
November 10, 2026 04:52
Nail taken verbatim from the wave-2 pure-pin PR branch (test/wave2-pins-i2 @ 64209f6, the I2 stem for the argv0 diagnostic-prefix issue). Seven tests / 26 assertion shapes: a renamed binary (argv[0] forced to "zimsh") must report every builtin cold-path diagnostic under the argv[0]-derived name, and script-form diagnostics under the script name. GNU anchors: error.c:90-120 get_name_for_error (BASH_SOURCE[0], else dollar_vars[0] verbatim, else base_pathname(shell_name), else PROGRAM "bash"); shell.c:1779-1806 set_shell_name (shell_name = argv0 verbatim); builtins/common.c:83-96 builtin_error_prolog. Refs #2791
…carrier chain
The builtin layer's private prefix helpers each re-implemented
only the (script, line) arm of GNU's diagnostic prolog and fell
back to a hard-coded "bash: " / "rubash: " literal when either
arm was missing — a second voice beside the executor's
error_report_name chain, wrong for any shell invoked under
another name (renamed binary, embedding host) whenever a
builtin diagnostic reached the fallback with one arm absent.
New single source src/builtins/prefix.rs mirrors the executor
chain (error.c:90-120 get_name_for_error; shell.c:1779-1806
set_shell_name; builtins/common.c:83-96 builtin_error_prolog):
innermost file, else $0 verbatim (BASH_ARGV0 carriers), else
base_pathname(shell_name), else PROGRAM "bash" — with the
single-arm shapes the old helpers dropped ({file}: with no
line, {name}: line N: with no file). Migrated onto it: pwd's
invalid-option arm, pushd's bindpwd_write and shopt's compat44
readonly diagnostic (err_readonly family, gnu_errfmt kept),
help's and kill's process-env prefixes, printf's two env-map
prefixes, and the standalone stdio Prolog name cells of exit,
shift and shopt.
Sites in files owned by in-flight PRs (alias, declare,
setattr, set, the shared builtins/diagnostic.rs, exec) are
deliberately untouched here; the census table and the
follow-up drafts are in the lane REPORT.
Refs #2791
Refs #3193
caomengxuan666
marked this pull request as ready for review
November 10, 2026 11:29
This was referenced Nov 10, 2026
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本 PR 做了什么
诊断前缀普查(全仓站点裁定表在车道 REPORT)+ #2791 冷路径收敛修法:
acca40e3):逐字取自波二纯钉 PR test: wave-2 pins I2 (Refs #2773 #2774 #2791 #2824) #3172 分支的tests/issue2791_diagnostic_prefix_argv0.rs(7 格 / 26 断言形)。银行口径对账:MANIFEST 记该茎 fail-first 从未实测、钉头注自述为回归锁;本车道在现 master 实跑基底 ≡ 头树 = 7 passed / 0 failed(逐茎test result行在车道日志),与回归锁口径一致。a2a92615):新建src/builtins/prefix.rs作为 builtin 层单一 argv[0] 派生源,逐字镜像执行器error_report_name的载体链(GNUerror.c:90-120 get_name_for_error;shell.c:1779-1806 set_shell_name;builtins/common.c:83-96 builtin_error_prolog):最内层文件 → $0 逐字(BASH_ARGV0 载体)→ base_pathname(shell_name) → PROGRAM "bash",并补齐旧实现丢弃的单臂形。迁入站点:pwd 无效选项臂、pushdbindpwd_write、shopt compat44 只读诊断(err_readonly 族,gnu_errfmt 保留)、help/kill 进程 env 前缀、printf 两 env-map 前缀、exit/shift/shopt 的 stdio 入口 Prolog 名格。本 PR 删除了什么
(script, line)-or-字面量前缀实现("bash: "/"rubash: "fallback 臂),统一改走新builtins::prefix链。"rubash"字面名格,改由载体链派生。验证
RUSTFLAGS="-D warnings"cargo check rc=0;cargo fmt --check全量 rc=0。Refs #2791
Refs #3193