-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix typeset attributes -a, -A, -l, -u leaking out of subshells
If an array or upper/lowercase variable was declared with a null initial value within a virtual/non-forked subshell, like: ( typeset -a foo; ... ) ( typeset -A foo; ... ) ( typeset -l foo; ... ) ( typeset -u foo; ... ) then the type declaration leaked out of the subshell into the parent shell environment, though without any values that may subsequently have been assigned. src/cmd/ksh93/bltins/typeset.c: setall(): - When deciding whether to create a virtual subshell scope for a variable, use sh_assignok(), which was actually designed for the purpose, instead of _nv_unset(). This allows getting rid of a tangled mess of special-casing that never worked quite right. src/cmd/ksh93/tests/arrays.sh: - Add regression tests checking that array declarations don't leak out of virtual subshells. src/cmd/ksh93/tests/attributes.sh: - Add regression tests for combining the 'export' and 'readonly' attributes with every other possible typeset attribute on unset variables. This also includes a subshell leak test for each one. Fixes: #88
- Loading branch information
Showing
4 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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