Skip to content

fix(executor): thread the list-abort through export/readonly OOB (#635) - #677

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/issue635-export-abort
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/issue635-export-abort

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

fix(executor): thread the list-abort through export/readonly OOB (#635)

What

export -a a=( [-2]=q ); echo AFTER printed AFTER with rc 0; GNU
prints the bad-subscript diagnostic, no AFTER, rc 1 (same for
readonly -a). export -a/-A delegates to nested declare_builtin
(setattr.def:240-268), so OOB takes the declare path:
arrayfunc.c:804-809 err_badarraysub+any_failed+break, then
DISCARD (subst.c:11169).

Fix (mirrors declare/local #658 exactly)

  • apply_export_arg/apply_readonly_arg take oob_word: &mut Option<String>: partial store+marks stay, FAILURE returned, no
    print. Operand loops stop on OOB (later operands never run).
  • Executor export/readonly arms: bare <word>: bad array subscript (no export:/readonly: segment), exit_code=1,
    evalerror_subscript_pending + raise_evalerror_abort (eval does not contain the assignment DISCARD jump (eval 'a[-2]=q' ends the whole script) #637, so
    eval contains it), flush, return 1. Direct
    export()/readonly() wrappers print the bare diagnostic (no
    Executor to abort through).

Verification

  • New issue635_export_abort_regressions (13 tests).
  • Existing: issue635_builtin_oob 10, setattr unit 3, issue534
    15, issue528 15, array_store_parity 2 — all pass.
  • 18-case probe matrix (export/readonly × -a/-A × OOB/partial/append/
    multi-op/eval/subshell/trap/in-range/success) byte-identical to GNU
    (stdout+stderr+rc) 18/18.
  • Full serial failure-set gate vs master: per-target results match
    except the new regression file itself (13/13, absent on master).
    Test-level 4 NEW / 3 DISAPPEARED, all seven in the
    known-nondeterministic part_080 coproc family (all pass in isolation
    on branch). No regression.
  • niubash product A/B (niubash pinned 6295367, only rubash [patch]
    switched): 50 vs 49, the single extra
    (epochrealtime_beats_external_date_for_timing) is the known load
    flake — fails 2/3 on master in isolation too.

export -a a=( [-2]=q ); echo AFTER printed AFTER rc 0; GNU diagnoses,
no AFTER, rc 1 (same readonly -a). export -a/-A delegates to nested
declare_builtin (setattr.def:240-268): arrayfunc.c:804-809 any_failed +
DISCARD (subst.c:11169).

Mirrors declare/local #658: apply arms record oob_word, keep partial
store, stop the operand loop; Executor arms print the bare diagnostic,
exit 1, raise the #637 evalerror abort. 13 new tests; 18/18 GNU probe
matrix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant