Repository navigation
W-I1 interactive routes: pins + main record + histexpand default (Refs #2731 #2732 #2733 #2734) - #3245
Merged
Conversation
…t is set-if-unset #2732: make_cmd.c:746-762 make_function_def records "main" when BASH_SOURCE is empty in an interactive shell; the definition-site record now mirrors that order (new definition_source helper in function_calls.rs; current_bash_source itself untouched). #2733: shell.c:1839 init_interactive / bashhist.c interactive HISTEXPAND_DEFAULT seeding must not override an explicit opt-out; both histexpand seeding sites (main.rs apply_init_interactive_defaults and script_driver.rs initialize_interactive_history) are now set-if-unset on the __RUBASH_SETOPT_histexpand carrier, so +H at invocation and a startup file's set +H survive. Refs #2732 Refs #2733
caomengxuan666
added a commit
that referenced
this pull request
Nov 11, 2026
) Fixes #2734 ## 缺陷面 交互现行输入的解析诊断缺 GNU parser_error 第一分支: - piped `-i`:诊断名用 argv[0] 全路径,GNU 只给 basename; - `-i -c`:`{全路径}: -c: line 1: …`,段(`-c:` + line)与名双差,GNU 只给 basename、无任何段。 (钉茎基底 5 过 / 2 红,红名恰此两格;现形由 PR #3245 复核在 combo 上实测登记。) ## 修法 `src/executor/public_accessors.rs` 四个 parser 前缀合成点(`parser_diagnostic_prefix`、`parser_error_prefix`、`parser_diagnostic_prefix_for_line`、`parser_error_prefix_for_line`)顶部同补 GNU 第一分支:谓词 `invocation_interactive() && __RUBASH_INTERACTIVE_FLAG_OFF 未置`(该载体是 GNU `interactive` 全局量的引擎编码,已有消费先例:main.rs 的 -i script 路由置位、session.rs、prompt_command.rs、job_builtins.rs)→ 只返回 `{interactive_shell_basename}: `。EVAL/TRAP/source 上下文臂顺序保持在新分支之后;`-i script` 因 FLAG_OFF 在场自然落回文件形。按机制补分支,不逐调用点打补丁。 GNU 锚:error.c:300-316 `parser_error`(`interactive` 只印 ename;`interactive_shell` 才印 `iname: line N:`);error.c:110-111 `base_pathname (shell_name)`;error.c:80 行段仅 `interactive_shell == 0` 时出现。 ## 钉 `tests/issue2734_interactive_diag_line_segment.rs`(7 格)与 PR #3245 头逐字节一致(sha256 `68a1210a038e93e1759fe3b49bef0e29332a31d4469ae9f125d40cacdd32379f`);PR #3245 合入后本分支 rebase 时此钉按同文处理、不产生双份。 ## 验证(队长复核亲跑,Simular box;卷宗 `~/workspace/review-3332/CAPTAIN-VERIFY.md`) - fail-first:真 merge-base `5d8867fd` + top-up 钉 = 5 过 / 2 红,红名恰登记两格,断言原文与 PR #3245 卷宗 §10 登记逐字一致。 - 终头 `42d618931151754a3dcf96bcc22536239063c488`(update-branch 合并头,其树与合入轮在 box 实测的合并树逐 OID 一致):issue2734 茎 7/7;邻茎双边同形——issue2731 6/6、issue3035 6/6、issue2733 4 过 1 红(`histexpand_optout_controls`,PR #3245 面)、issue2732 2 过 3 红(记录面三格,PR #3245 面)、issue2739 3 过 1 红(基底既存的非交互 argv[0] 期望形)——红名集双边逐字一致,无回归。 - lib 双边(先建 `--bin rubash`)1243 过 / 0 红 / 4 忽略,失败名集差 ∅。 - `RUSTFLAGS="-D warnings"` / fmt --check(完整检出树)/ 全树 UTF-8 / marker-lint / `cargo check --tests` 全 rc=0;产品 diff 无 `libc::` 命中。终头 CI 11 腿 10 success + 1 skipped、零红。 ## 本 PR 删除了什么 无删除:产品码纯增(`src/executor/public_accessors.rs` 净 +50/−0),另新增钉文件一份(+265/−0);分支对基底总 diff +315/−0。
caomengxuan666
marked this pull request as ready for review
November 11, 2026 08:22
This was referenced Nov 11, 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.
W-I1 交互路由波二钉转修法:四茎钉(取自 PR #3175)+ 两单修法 + 一单回归锁 + 一单停手待裁。
Refs #2731
Refs #2732
Refs #2733
Refs #2734
逐单状态(基底 9ec0355 实测,逐茎 test result 行在车道日志)
修法(提交 a31e38d,3 文件 +40/−4)
main#2732 记录面:GNU make_cmd.c:746-762(make_function_def)——BASH_SOURCE 数组为空且交互时,定义记录为 "main"。新增definition_source(src/executor/function_calls.rs):栈空且 invocation_interactive 时记录 "main",其余走原current_bash_source(本体不动,其调用帧回退与诊断名消费面不受影响)。Hin $-) missing on the-i -cand-i scriptinteractive routes #2733 播种面:GNU shell.c:1839(init_interactive)/ bashhist.c 交互 HISTEXPAND_DEFAULT——默认不得覆盖显式 opt-out。两处 histexpand 无条件置位(src/main.rs apply_init_interactive_defaults、src/script_driver.rs initialize_interactive_history)改为__RUBASH_SETOPT_histexpand载体判据的 set-if-unset 形:命令行+H与启动文件set +H均存活。基底唯一红格 histexpand_optout_controls(+H -i -c实测 hiBHc,GNU hiBc)转绿,其余四格不变。#2732 剩余红的门控(请队长知悉)
剩余三格的共同根在 BASH_SOURCE 视图层:无脚本主帧时视图无条件 pop 栈底,而交互会话没有 $0 seed、栈底即真帧(单格 [main] 被 pop 成空、链格 [main main] 被 pop 成 [main]、source 链格同理)。该面是在飞 PR #3135(issue #3125)的本体修法(仅当栈底等于所记录 seed 才 pop),本车道不复制其工作(文件面重叠)。#3135 合入后本茎期望 5/5,请合入序上让 #3135 先行或同批复跑本茎。
#2734 停手说明(撞车关口)
修法落点为 src/executor/public_accessors.rs 的四个 parser 前缀合成点(parser_diagnostic_prefix / parser_error_prefix 及 for_line 孪生)。开工核查时该文件同时被 PR #3145、#3135、#2968 三支在飞 PR 占用(区段互不重叠),按车道纪律停手:本 PR 只落钉与 fail-first 证据,修法设计全文在车道 REPORT §4(谓词 = invocation_interactive 且 __RUBASH_INTERACTIVE_FLAG_OFF 未置;piped 格现基底红因已订正为诊断名全路径 vs GNU basename,-i -c 格为段与名双差)。请队长在 #3135/#2968 落地后解闸续派,或明示豁免后由本分支续作。
验证(车道实测,日志 ~/workspace/fix-W-I1/logs/)
本 PR 删除了什么
不合入、不关单,听队长复核。