Repository navigation
fix(executor): consume the arithmetic fatal flag at the triggering command boundary - #3365
Merged
Merged
Conversation
…mmand boundary The three arithmetic error flags are one error record and must be consumed whole by the command that triggered them. Only the latch and non-fatal bits were consumed, so the fatal bit leaked into the next (( )), let or for (( )) command, which was then skipped with all diagnostics silenced. GNU keeps no cross-command error state. Refs unixwin#3287 Regression pin: tests/issue3287_fatal_fast_assignment_flag_leak.rs (9 tests; fail-first 4 failed on the unpatched tree, 9/9 pass after). Adjacent families (unixwin#3246, unixwin#2596, unixwin#1226, unixwin#439, unixwin#1541, unixwin#2125, unixwin#2126 and others) green. Owed: [[ ]] operand fatal leak; mixed-assignment and subshell-prefix paths still ignore arithmetic_error; set -e + for (( i=1/0; ...)) and set -e + bad-substitution GNU behaviour unverified.
Member
|
Thanks for the PR. This is queued for captain review — collaborator PRs are reviewed by the captain before merge, and #3287 stays open until that review lands. CI at intake: one red leg — Rust tests (macOS), the "Run Rust library tests" step failed; all other legs green. The captain's review will adjudicate whether it is change-related. No action needed unless the review asks for changes. |
This was referenced Nov 11, 2026
caomengxuan666
marked this pull request as ready for review
November 11, 2026 15:33
This was referenced Nov 12, 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.
Fixes #3287
What was fixed
After a fatal fast assignment, the arithmetic error flags leaked across commands: only the latch and non-fatal bits were consumed, so the fatal bit stayed in place and the next
(( ))/let/for (( ))was skipped before evaluation, with all diagnostics silenced. GNU keeps no cross-command error state (expr.c:1525evalerror only longjmps out of the current evaluation).The fix treats the three flags as one error record that the triggering command consumes whole at its boundary: fast-assignment consumption sites clear the fatal (and non-fatal) bits,
execute_arithmetic_commandconsumes all flags on nested fatal and returnsErr(ExpansionFailure(1))(DISCARD), andfor (( ))headers call the existing abandon helper after a failed evaluation.What was deleted
Nothing. No files, features, or tests were removed.
Verification (all run, per-item counts)
tests/issue3287_fatal_fast_assignment_flag_leak.rs: 9/9 pass. Fail-first on the unpatched tree: 3 passed / 4 failed (of the original 7 cases).(( ))arithmetic error diagnostic ignores the command's own2>&1redirection #1127 1/1, [bug] readonly assignment in function body /{ }group does not abandon rest of line (GNU aborts the list) #1318 5/5, let families 4/4 + 17/17, DISCARD/POSIX families 9/9 + 21/21 + 27/27 + 3/3 + 10/10, niubash529 7/7.bash: line 1:prefix; [bug] Ctrl-C during fg wait runs the rest of the line; GNU discards it (fresh prompt) #1639 (SIGINT/PTY timing, flaky).Err(ExpansionFailure), which regressed [parser] 未终止 ${ 于算术体内吞掉自身闭合:$((1+${x)) 报 EOF looking } rc=2(GNU 展开期 bad substitution rc=1)(P2) #533; it was reverted to status 1 + flag clearing and [parser] 未终止 ${ 于算术体内吞掉自身闭合:$((1+${x)) 报 EOF looking } rc=2(GNU 展开期 bad substitution rc=1)(P2) #533 is byte-identical again.cargo build -j 2clean,cargo fmtclean.src/lexer/continuation.rsuntouched.Owed
gnu-extra.sh8/8 acceptance probes are not in this workspace; not pinned.[[ ]]operand fatal leak ([[ $(( 1/0)) = x ]]then the next echo is still discarded) — the[[ ]]dispatch needs its own abort check; direction is the captain's call.arithmetic_error(pre-existing gaps, not the leak itself).set -e+for (( i=1/0; ...))pure-evaluation failure andset -e+(( ))bad-substitution: GNU behaviour unverified, out of scope.