You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] set -a does not mark a scalar assignment over an existing indexed array #2963
area:builtinsbuiltin semantics (printf/declare/command/type/...)bugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Under set -a, a scalar assignment over an existing INDEXED array does not take the export mark in rubash, while GNU marks it. The associative twin already matches (both shells show -Ax), so the gap is specific to the indexed scalar-over-array bind arm. Found while probing the r79 batch (Refs #2944 / #2945); it is a different bind arm from those issues and is filed separately rather than folded into that batch.
set -a; declare -A m=([k]=v); m=scalar; declare -p m → declare -Ax m=([0]="scalar" [k]="v" ) on both.
arr[0]=x; export arr; arr=abde; declare -p arr (pre-exported, no set -a) → declare -ax on both, and printenv arr fails on both (an array's value never crosses the env boundary in either shell — only the ATTRIBUTE diverges).
GNU semantics
A scalar value bound over an existing array still goes through bind_variable (variables.c), whose tail applies the mark_modified_vars mark (variables.c:3211-3212) while set -a is on (flags.c:47,167) — the array's assign_func stores element 0, but the bind itself is a scalar bind for marking purposes. The associative leg of rubash's assignment path already mirrors this; the indexed leg's arm (the element-0 write path in the assignment executor) projects the value into the process env instead of setting the export attribute.
Regression seed
set -a
arr[0]=x
arr=abde
declare -p arr # GNU: declare -ax arr=([0]="abde")
area:builtinsbuiltin semantics (printf/declare/command/type/...)bugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Activity
r79: allexport local/readonly + array marks, assoc subscript single-e…
fix: allexport mark for scalar-over-indexed bind; stand down for decl…
fix: allexport marks — scalar over indexed array; declare compound in…