Skip to content

POSIX-mode readonly/export listings use the builtin name (batch86) - #290

Merged
brianjfox merged 1 commit into
mainfrom
fix/testsuite-batch86
Jul 24, 2026
Merged

POSIX-mode readonly/export listings use the builtin name (batch86)#290
brianjfox merged 1 commit into
mainfrom
fix/testsuite-batch86

Conversation

@brianjfox

Copy link
Copy Markdown
Owner

Summary

In POSIX mode, readonly and export list variables with their own name as the prefix and only the array-type attribute — the implied readonly/exported flag and i/n/t/c/l/u are dropped (bash show_var_attributes / var_attribute_string, setattr.def):

$ set -o posix; readonly x=5; readonly -a a=(1 2); declare -i n=7; readonly n; readonly -p
readonly -a a=([0]="1" [1]="2")
readonly n="7"
readonly x="5"

gnash always printed declare -ar a=... / declare -r x="5" regardless of POSIX mode. Added a cmd/posix pair to declare_print_var; declare/typeset/local and all non-POSIX listings are unchanged.

Testing

  • ctest 22/22
  • Scoreboard: array 225 → 221, zero regressions across the full suite
  • Verified scalar/integer/array/assoc and non-POSIX control cases against bash 5.3

Closes #289.

…mode

In POSIX mode, `readonly' and `export' list variables with their own name as
the prefix and only the array-type attribute -- the implied readonly/exported
flag and i/n/t/c/l/u are dropped (bash show_var_attributes / var_attribute_
string, setattr.def).  gnash always printed `declare -ar name=...' / `declare
-r x="5"' regardless of POSIX mode.

Add a cmd/posix pair to declare_print_var: when POSIX mode is on and the
invoking builtin is readonly or export, print `<cmd> [-aA] name=value' (no flags
at all for a plain scalar).  declare/typeset/local and all non-POSIX listings
are unchanged.

Closes #289.
@brianjfox
brianjfox merged commit ae8570e into main Jul 24, 2026
1 check passed
@brianjfox
brianjfox deleted the fix/testsuite-batch86 branch July 24, 2026 22:48
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.

In POSIX mode, readonly/export listings should use the builtin name, not declare

1 participant