Repository navigation
Closed
Labels
area:builtinsbuiltin semantics (printf/declare/command/type/...)bugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Description
Summary
With set -a (allexport), GNU marks every subsequently created variable for export — including variables created with an initializer by the local and readonly builtins. rubash does not: local z=9 / readonly r=1 under set -a leave the variable unexported.
Repro
set -a; f(){ local z=9; printenv z; }; f
set -a; readonly r=1; printenv r| GNU bash 5.3.20 | rubash master 500769e | |
|---|---|---|
local facet |
prints 9 |
prints nothing (rc 1) |
readonly facet |
prints 1 |
prints nothing (rc 1) |
declare -p confirms the missing attribute:
set -a; f(){ local z=9; declare -p z; }; f
# GNU: declare -x z="9"
# rubash: declare -- z="9"
set -a; readonly r=1; declare -p r
# GNU: declare -rx r="1"
# rubash: declare -r r="1"Scope (morph, GNU vs rubash, two passes, identical)
- DIFF:
local z=9,local -i n=5,local+declare -p(mA1/mA2/mA8);readonly r=1,readonly+declare -p(mB1/mB5). - SAME (controls):
declare z=9inside a function and at top level both export underset -a(mA5/mA9);local zfollowed by a separatez=9assignment exports (mA4);declare -randtypeset -rboth export underset -a(mB2/mB6);r=1; readonly rexports (mB3). So only thelocal/readonlyinitialization paths miss allexport — thedeclare/typeset/plain-assignment paths already honor it. - Related closed [export] 前缀赋值过持久 + allexport 不打标无值声明:FOO=val export BAR 后 FOO 残留(GNU unset);set -a declare v 无 -x (P2) #538 (
set -a; declare vvalueless declaration) is fixed on current master (re-verified:declare -x von both shells); this issue is the remaininglocal/readonlyfacets, not a reopen of [export] 前缀赋值过持久 + allexport 不打标无值声明:FOO=val export BAR 后 FOO 残留(GNU unset);set -a declare v 无 -x (P2) #538.
Regression seed:
set -a; f(){ local z=9; [ "$(printenv z)" = "9" ] && echo "local-export: PASS" || echo "local-export: FAIL"; }; f
set -a; readonly r=1; [ "$(printenv r)" = "1" ] && echo "readonly-export: PASS" || echo "readonly-export: FAIL"Expected (GNU): both lines PASS. Actual (rubash master 500769e): both lines FAIL.
Source
Differential hunt r79 (set/shopt option semantics, second round), oracle GNU bash 5.3.20, verified on fresh master build 500769e (two passes, stable).
Metadata
Metadata
Assignees
Labels
area:builtinsbuiltin semantics (printf/declare/command/type/...)bugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Activity
fix: r79 allexport marks, assoc subscript single-eval, source diagnos…
r79: allexport local/readonly + array marks, assoc subscript single-e…