Repository navigation
fix(executor): bind empty array for failed compound assignment (rubash#3383) - #3458
Merged
Merged
Conversation
…h#3383) GNU arrayfunc.c:507-517 assign_array_from_string runs find_or_make_array_variable BEFORE assign_array_var_from_string expands the elements, so a brand-new compound target is bound as an empty indexed array even when an element expansion fails fatally and the command is abandoned. Rubash kept this contract in the nonfatal arm of execute_empty_words_command but returned from the fatal arm without binding, so a=($((1/0)) 2) left a unbound (declare: a: not found) where GNU leaves declare -a a=(). Extract the shared helper bind_empty_array_for_failed_compound_assignment and call it from both arms (the nonfatal arm now calls the helper instead of its inline copy, logically identical); the fatal arm calls it before every return below. A pre-existing target or a declared-but-unset one keeps its prior state (niubash #121). Refs rubash#3383. Regression pin tests/issue3383_mixed_assign_arith_error.rs (11 cells, GNU 5.3.20 literal expectations). Face 2 of #3383 (pipeline-element prefix) is a separate mechanism, filed as rubash#3456 and deliberately not pinned here.
Member
Author
|
【WIN-AGENT-AUDIT】 PR #3458 第1轮 — 建议:PASS 机制核查:
腿(逐项):
F 点:无。 续作记录:未动代码。 未跑/VOID 的腿:
|
caomengxuan666
marked this pull request as ready for review
November 15, 2026 02:06
This was referenced Nov 15, 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.
Refs rubash#3383.
GNU arrayfunc.c:507-517 assign_array_from_string runs find_or_make_array_variable BEFORE assign_array_var_from_string expands the elements, so a brand-new compound target is bound as an empty indexed array even when an element expansion fails fatally and the command is abandoned. Rubash kept this contract in the nonfatal arm of execute_empty_words_command but returned from the fatal arm without binding, so
a=($((1/0)) 2)leftaunbound (declare: a: not found) where GNU leavesdeclare -a a=(). This PR extracts the shared helper bind_empty_array_for_failed_compound_assignment and calls it from both arms (the nonfatal arm now calls the helper instead of its inline copy, logically identical); the fatal arm calls it before every return below. A pre-existing target or a declared-but-unset one keeps its prior state (niubash #121).Regression pin tests/issue3383_mixed_assign_arith_error.rs (11 cells, GNU 5.3.20 literal expectations). Face 2 of #3383 (pipeline-element prefix) is a separate mechanism, filed as rubash#3456 and deliberately not pinned here.
Local legs not run: the local write wall is closed (cargo rc=101 disk I/O error 778; git commit EPERM), so CI compile is the first verification; full legs run at captain review on X299/box.
本 PR 删除了什么
无产品符号删除:非致命臂的内联空数组绑定块移入同一文件内的共享 helper(同一逻辑);未删除任何公开/内部函数、符号或测试文件。
UNVERIFIED-BY-CAPTAIN