Repository navigation
fix(diagnostic): route histexpand failure + Invocation -c seed through argv[0] chain (Refs #3255) - #3611
Merged
caomengxuan666 merged 3 commits intoNov 16, 2026
Conversation
Member
Author
|
【WIN-AGENT-AUDIT】 |
Member
Author
|
【WIN-AGENT-AUDIT】 机制核查:
腿:
F 点:无。 续作记录(本轮动过代码):
合入:
未跑/VOID 的腿:
|
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.
Refs #3255
根因(两点,同属 #3193 诊断名派生漏斗残留)
src/script_driver.rsrun_history_group:历史展开失败前缀是手写的(script, line)match,任一缺失即落字面"bash: "。交互读线期 line 已由set_current_line_value盖戳,script 名从不在该路上播种,所以可达形恰是字面臂:改名二进制 +rubash -i管道输入!nosuch即印bash: !nosuch: event not found。src/invocation.rsShellInvocation::apply_to_executor:宿主经 Invocation API 驱动-c且未给显式$0时,往__RUBASH_SCRIPT_NAME种字面"bash";main.rs 孪生位点已按 [B1-11] Diagnostic prolog hardcodesbashinstead of the argv[0]-derived name (owner decision: impersonation vs fidelity) #2714 改为 BASH_ARGV0 派生,此为 API 孪生残留。宿主(niu 类)以改名 argv0 经 Invocation 驱动-c时诊断名被种成"bash"。GNU 锚
bashhist.c:594 pre_process_line经internal_error ("%s", history_value)→error_prolog(error.c:75-86)→get_name_for_error(error.c:90-120)。交互壳只印壳名、无行号段;eval/-c段只属于parser_error(error.c:300-316),internal_error没有。-c无显式$0时诊断名即dollar_vars[0]:error.c:90-120;操作数成$0:shell.c:523-528。exec -a myname bash -i+!nosuch→myname: !nosuch: event not found;平 argv0 →bash: !nosuch: event not found。修法
error_prefix()族(该点已有 executor 在手):交互形得壳 basename、无行号段;脚本/-c形得name: line N:(gnu_errfmt 门同族);{script}: eval手写臂随之消失——按 GNU,internal_error诊断本无eval段。-c种名位点逐字镜像 main.rs 孪生位点([B1-11] Diagnostic prolog hardcodesbashinstead of the argv[0]-derived name (owner decision: impersonation vs fidelity) #2714 + 空 argv[0] 调用时 $0 被种成 /、诊断印 /: …(GNU 印空名) #3355 空$0规则):BASH_ARGV0 非空即逐字种入;现存空$0留空(carrier 不播种);全无 carrier 才取 PROGRAM"bash"。显式-c名操作数仍优先;内部 respawn(coproc/async 子进程)经 init.rs 继承父名、不覆盖。本 PR 删除了什么
run_history_group里的手写(script, line)前缀 match 整段(含{script}: eval臂与字面"bash: "回退臂);该诊断现由执行器error_prefix()单一派生链提供。invocation.rs里-c无显式$0时种字面"bash"的旧分支与注释(行为由 BASH_ARGV0 派生取代;全无 carrier 时的 PROGRAM"bash"回退保留)。验证(待队长复核,腿在 REPORT)
tests/issue3255_histexpand_prefix_invocation_name.rs(6 格:Invocation 派生/空$0/无 carrier/显式操作数守卫 + 交互改名/平 argv0 前缀)。RUSTFLAGS="-D warnings"check、fmt:见~/workspace/fix-3255/REPORT.md。构建槽位当时状况亦记于 REPORT(box 内存/磁盘门未过、老服务器 ssh banner 超时)。UNVERIFIED-BY-CAPTAIN