Repository navigation
fix(executor): #858 — \ must restore the word-internal comsub \True overlay - #891
Merged
Merged
Conversation
…$? overlay too
GNU decode_prompt_string snapshots last_command_exit_value and
last_command_subst_status around the promptvars pass (parse.y:6684-6697),
and subst.c string_transform 'P' routes through the same
decode_prompt_string — so the ${var@P} operator is covered by the same
status bracket. The #813 fix restored last_command_substitution_status,
but the word-internal `$?` read path consults word_expansion_comsub_exit
FIRST (parameter_core dollar_question_status, issue #485's comsub
overlay). An @p pass whose embedded `$(exit N)` latched onto the overlay
therefore leaked into a later `$?` in the SAME command line:
PS1='$(exit 7)p '; true; echo ${PS1@P} $?
GNU prints `p 0`; rubash printed `p 7`.
expand_embedded_parameters_double_quoted now snapshots and restores
word_expansion_comsub_exit alongside last_command_substitution_status, so
the prompt pass is transparent to both read paths. The overlay's own
publication contract (#485: a real `$(false)` in the same word still
governs `$?`) is intact — the restore only shields the transform's
internal reads.
Verified vs WSL GNU bash 5.3.9 (the local 5.3-series oracle; the file at
/usr/bin/bash — /usr/local/bin/bash is no longer present in this WSL):
`echo ${PS1@P} $?` and `case ${PS1@P}` both byte-identical, plus the
#485-published `$(false)` status still wins its own word. Regressions:
issue485 (both arms), issue813, issue604 green; new test
prompt_transform_does_not_leak_into_word_level_dollar_question.
Contributor
|
欢迎!这是你的第一个 PR 🎉 请确认已跑过本地测试套件;CI 通过后维护者会 review。 |
Member
独立评审结论:APPROVE-WITH-NITS(评审代理独立复验:自建克隆 + worktree 复现与修复对照(输出与 oracle 逐字节比对)
关键确认:bracket 采用 回归与审计
NIT(不阻塞)
不合并(按评审纪律由维护侧执行)。 |
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 #858.
GNU
decode_prompt_stringsnapshotslast_command_exit_value/last_command_subst_statusaround the promptvars pass (parse.y:6684-6697), andsubst.c string_transform 'P'routes through the same function — so${var@P}is covered by the same status bracket. The #813 fix restoredlast_command_substitution_status, but the word-internal$?read path consultsword_expansion_comsub_exitfirst (parameter_core dollar_question_status, the #485 comsub overlay). An@Ppass whose embedded$(exit N)latched onto the overlay therefore leaked into a later$?in the same command line:expand_embedded_parameters_double_quotednow snapshots and restoresword_expansion_comsub_exitalongsidelast_command_substitution_status— the prompt pass is transparent to both read paths, while the #485 publication contract (a real$(false)in the same word still governs$?) stays intact.Verified vs WSL GNU bash 5.3.9 (the 5.3-series oracle here —
/usr/local/bin/bashis absent in this WSL,bashresolves to 5.3.9; AGENTS.md's 5.3.0 path is a stale snapshot, the 5.3-series oracle contract holds).echo ${PS1@P} $?andcase ${PS1@P}byte-identical; #485-published$(false)status still wins its own word. Regressions: issue485 (both arms), issue813, issue604 green + newprompt_transform_does_not_leak_into_word_level_dollar_question.