POSIX-mode readonly/export listings use the builtin name (batch86) - #290
Merged
Conversation
…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.
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.
Summary
In POSIX mode,
readonlyandexportlist variables with their own name as the prefix and only the array-type attribute — the implied readonly/exported flag andi/n/t/c/l/uare dropped (bashshow_var_attributes/var_attribute_string, setattr.def):gnash always printed
declare -ar a=.../declare -r x="5"regardless of POSIX mode. Added acmd/posixpair todeclare_print_var;declare/typeset/localand all non-POSIX listings are unchanged.Testing
array225 → 221, zero regressions across the full suiteCloses #289.