Repository navigation
fix(prompt,executor): #813 CR followups — ${var@P} comsub status bracket (parse.y:6684-6697), sudo no-handler route pins, prompt-render benchmark - #854
Merged
Conversation
…atus bracket, sudo no-handler route pins, prompt-render benchmark #813 items from the #810 (#759/#757) CR findings: 1. ${var@P} prompt-transform channel no longer leaks command-substitution status into $? (CR F3). GNU parse.y:6684-6697 snapshots/restores last_command_exit_value + last_command_subst_status around the promptvars pass (parse.y:6689) inside decode_prompt_string; subst.c string_transform 'P' routes through the same function, so ${PS1@P} is covered. rubash#604 fixed the interactive render channel (expand_prompt_string_mut rc/PIPESTATUS bracket); the operator path published the embedded $( ) body's reaped status through the comsub-status cell the assignment boundary reads. Fix lands in the shared prompt-pass engine (expand_embedded_parameters_ double_quoted — both its callers are prompt channels: the @p transform and the piped -i render) restoring the cell to its PRE-pass value, plus the same cell bracket in expand_prompt_string_mut (parse.y:6687/:6697 restores last_command_subst_status with the exit value). Restore is value-preserving, not clearing: w=$(false)${PS1@P} keeps rc 1 like GNU. WSL GNU 5.3.0 probes: true; p=${PS1@P} -> rc 0 p=[xy] (was 1); false; q=${PS1@P} -> rc 0; mixed RHS -> rc 1. Regression: tests/issue813_prompt_transform_status_regressions.rs (3). 2. sudo no-handler execution-route pins (CR F4), windows-only: sudo_without_handler_executes_the_path_command (fake sudo.cmd on PATH actually runs, rc 0) and builtin_sudo_without_handler_reports_not_a_ shell_builtin (GNU wording, rc 1). tests/regression.rs. 3. benchmarks/30-prompt-render-transform-x5000.sh (CR F6): 5000 ${PS1@P} renders of a spawn-free theme-shaped PS1 pinning the ~50us/render engine budget; runs OK under scripts/run-perf-suite.sh on both engines (rubash 539ms vs WSL GNU 75ms median, runs=3). 4. command_execute.rs heredoc-fatal classification drops the is_shell_ builtin_name disjunct — fully subsumed by routes_as_builtin on both platforms (CR F7). 5. CHANGELOG: new 变更 section disclosing the Windows no-host sudo behavior change (#810: 'elevation handler is not configured' rc 1 -> PATH/127), plus the 修复 entry for item 1. Gate: cargo fmt --check clean; RUSTFLAGS='-D warnings' cargo check clean; full --test-threads=1 --no-fail-fast failure set identical 1:1 to a clean origin/master (b79e678) build (34 == 34); merged tree rerun 35 with only the documented flaky executor::path listing-cache lib test, green on rerun; issue604/757/393/421/431/433/pb10k suites all green.
Member
Author
独立代码评审:APPROVE-WITH-NITS评审树:自建 detached worktree @ 802257c(base fff4ada 实为 merge-base,已核实单 commit)。全部验证实做,逐点如下。 五项主张逐条核实1. ${PS1@P} 状态泄漏修复面(F3)— 核实成立
2. sudo 两臂测试钉(F4)— 核实成立
3. 基准(F6)— 核实可跑、口径一致
4. 冗余析取清理(F7)— 核实行为中性
5. CHANGELOG — 核实无遗漏:新增「变更」节披露 #810 无宿主 sudo 行为变化(rc 1 → PATH/127、 门禁复核(本机实测)
非阻塞备注(NIT / 建议跟进票)
结论:APPROVE-WITH-NITS。 五项全部核实成立,门禁全过,无 BLOCKER。 |
# Conflicts: # CHANGELOG.md
This was referenced Oct 19, 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.
Closes #813 — the five-item follow-up package from the #810 (#759/#757) CR findings.
五项逐项状态
1. ${PS1@P} 通道泄漏命令替换状态 — 已修(语义修)
GNU 律(vendored 5.3 实锚):
decode_prompt_string在 promptvars 遍历前后快照/恢复last_command_exit_value与last_command_subst_status(parse.y:6684-6697,expand_prompt_string 在 :6689);subst.c string_transform 'P' 走同一decode_prompt_string,${var@P}同受覆盖。与 #604 的关系:#604 修的是交互渲染通道(expand_prompt_string_mut快照恢复 rc/PIPESTATUS,PR #605),本票是@Poperator 路径——遍历引擎的 comsub 边界把$( )体收割状态写进替换状态 cell,赋值边界把它当替换退出规则发布。落点:共享 prompt 遍历引擎
expand_embedded_parameters_double_quoted(它的两个 caller 都是 prompt 通道:@P变换 + 管道-i渲染)把 cell 恢复到遍历前值(保真恢复而非清零),外加expand_prompt_string_mut的同款 cell 括号(parse.y:6687/:6697 连 last_command_subst_status 一起恢复)。保真性:w=$(false)${PS1@P}的词自身替换状态照常发布(GNU rc=1,两侧一致)。GNU 差分(WSL GNU Bash 5.3.0 stdin,2026-10-19):
true; PS1='x$(false)y'; p=${PS1@P}; echo $?false; q=${PS1@P}; echo $?PS1='r$(true)'; w=$(false)${PS1@P}; echo $?q2=$(false); echo $?(对照)回归:
tests/issue813_prompt_transform_status_regressions.rs(3 例)。GPL 红线:无 GPL 文本,parse.y 只引语义坐标。2. sudo 无 handler 执行路由两臂测试钉 — 已钉(纯测试,windows-only)
CR F4 的两臂(lookup_paths.rs
routes_as_builtin= windows+handler 门):sudo_without_handler_executes_the_path_command:假sudo.cmd上 PATH 实跑(marker 输出 + rc 0 透传),"elevation handler" 诊断不复现;builtin_sudo_without_handler_reports_not_a_shell_builtin:builtin: sudo: not a shell builtin,rc 1(GNU 措辞)。3. prompt 渲染基准条目 — 已补
benchmarks/30-prompt-render-transform-x5000.sh(#607-#609 同款 PERF 元数据方法学):无 spawn 的主题形 PS1(prompt escapes + 参数/算术/裸特殊参数内容)5000 次${PS1@P}渲染,钉 CR 实测的 ~50µs/次引擎预算。本地双引擎实跑(scripts/run-perf-suite.sh,runs=3):rubash 539ms vs WSL GNU 75ms 中位(~7.2x,10x 告警线内)。4. command_execute.rs 冗余析取 — 已清(CR F7)
heredoc-fatal 分类里的
is_shell_builtin_name(&expanded) ||删除——两个平台的routes_as_builtin均以纯表开头,完全覆盖。5. CHANGELOG — 已补
新增
### 变更节披露 Windows 无宿主 sudo 行为变化(#810:"elevation handler is not configured" rc 1 → PATH 实跑/127;introspection 契约不变),外加第 1 项的### 修复条目。验证三行
x=${PS1@P}类形态(PS1 内嵌$(false))GNU $?=0;修复后 rubash 三形态(干净/前置失败/混合 RHS)逐一对齐;[perf][P1] $(...) inside PS1 renders ~100x slower than the same call in PROMPT_COMMAND - four oh-my-bash themes hit 10x rr budget on CI #604 面回归 4/4 绿(issue604),prompt 家族 42/42 绿(393/421/431/433/757/pb10k)。cargo test --no-fail-fast -- --test-threads=1,branch 失败集 34 == 干净 origin/master(b79e678a)基线失败集 34,按用例名 1:1 双向comm为空;merge 最新 master(fff4adaf,build(package): exclude target-variant dirs from the crate — guard against >10MiB upload rejection #851 仅 .gitignore/Cargo.toml)后重跑 35,唯一新增为文档化的executor::pathlisting-cache flake(重跑即绿)。cargo fmt --check0 diff;RUSTFLAGS="-D warnings" cargo check(lib+bins)0 error;基准条目双引擎本地可跑(见第 3 项数据)。