Repository navigation
nounset pre-scan: run subscript comsubs, honor evalerror abort - #3592
Merged
Merged
Conversation
Refs #3540 Refs #3541 #3540: GNU evaluates an indexed subscript via expand_arith_string (arrayfunc.c:1356 array_expand_index -> subst.c:3981), which forks each comsub (subst.c:7143) before err_unboundvar names the parameter text. The pre-scan's nounset_subscript_unset_name split the subscript text and reported the comsub's first command (`echo`), and the braced-name arm of nounset_unbound_parameter_with_comsubs never collected bodies inside `${...}` so the child never ran. Both sides now treat `$(...)`/backtick spans inside the name text as forked units: bodies are collected in order and executed before the fatal, and the subscript scan skips them so `b[$(echo 5)]: unbound variable` names the parameter, not `echo`. Residual: GNU reprints the comsub canonically in the diagnostic name (`>&2` -> `1>&2`, print_comsub); the reported name still carries the verbatim text — a display-only divergence left for the reprint lane. #3541: evalexp's error jump (expr.c) abandons parameter_brace_expand BEFORE subst.c:8216 parameter_brace_expand_error can run, so an arithmetic failure inside the tested subscript is the whole verdict. scan_question_is_error now defers when the fetch raised the fatal-expansion flags, so `${a[$(echo E; echo 5)]:?err}` emits the arith diagnostic and aborts without the extra `:?` report. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
Author
|
【WIN-AGENT-AUDIT】 机制核查:
腿(逐项):
F 点:无。 |
Member
Author
|
【队长终裁】PASS 核过审计报告(6886565995)+ CI 全表。钉 3/3,fail-first 0/3(全红,症状与 issue 形状逐字一致);GNU oracle 三形状全一致(comsub 体不再被当下标文本拆出命令名;evalerror 跳转中止 |
caomengxuan666
marked this pull request as ready for review
November 15, 2026 02:05
This was referenced Nov 15, 2026
Closed
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.
Summary
Refs #3540
Refs #3541
#3540: GNU evaluates an indexed subscript via expand_arith_string
(arrayfunc.c:1356 array_expand_index -> subst.c:3981), which forks each
comsub (subst.c:7143) before err_unboundvar names the parameter text.
The pre-scan's nounset_subscript_unset_name split the subscript text and
reported the comsub's first command (
echo), and the braced-name arm ofnounset_unbound_parameter_with_comsubs never collected bodies inside
${...}so the child never ran. Both sides now treat$(...)/backtickspans inside the name text as forked units: bodies are collected in
order and executed before the fatal, and the subscript scan skips them
so
b[$(echo 5)]: unbound variablenames the parameter, notecho.Residual: GNU reprints the comsub canonically in the diagnostic name
(
>&2->1>&2, print_comsub); the reported name still carries theverbatim text — a display-only divergence left for the reprint lane.
#3541: evalexp's error jump (expr.c) abandons parameter_brace_expand
BEFORE subst.c:8216 parameter_brace_expand_error can run, so an
arithmetic failure inside the tested subscript is the whole verdict.
scan_question_is_error now defers when the fetch raised the
fatal-expansion flags, so
${a[$(echo E; echo 5)]:?err}emits thearith diagnostic and aborts without the extra
:?report.Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>