diff options
| author | Bart Schaefer <schaefer@zsh.org> | 2025-10-26 19:42:56 -0700 |
|---|---|---|
| committer | Bart Schaefer <schaefer@zsh.org> | 2025-10-26 19:42:56 -0700 |
| commit | 005ef2c8307ea032341d6e493c004a02a6f1e785 (patch) | |
| tree | d8583eb3d984c3d4de45c93cfa526eb632a88b49 /Test | |
| parent | 53798: report reference loops created when a reference goes out of scope (diff) | |
| download | zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.gz zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.bz2 zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.lz zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.xz zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.zst zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.zip | |
53676+54009: Revise 52650+51945 for assignment to global through nameref
Allows assignment to a global via nameref to succeed without creating a
dereference loop. Update tests for changed behavior.
Diffstat (limited to 'Test')
| -rw-r--r-- | Test/K01nameref.ztst | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst index 460bc7260..de9707c5e 100644 --- a/Test/K01nameref.ztst +++ b/Test/K01nameref.ztst @@ -882,6 +882,21 @@ F:Checking for a bug in zmodload that affects later tests >typeset -g var=RESET unset -n ref + unset var1 + typeset -n ref=var1 + () { + typeset -n ref=var2 + ref=RESET + typeset -p ref var2 + } + typeset -p ref var2 +0:local reference hides same-name global reference +>typeset -n ref=var2 +>typeset -g var2=RESET +>typeset -n ref=var1 +>typeset -g var2=RESET + + unset -n ref unset one typeset -n ref typeset one=ONE @@ -1045,14 +1060,17 @@ F:relies on global TYPESET_TO_UNSET in %prep () { typeset -n foo; foo=zz foo=zz || print -u2 foo: assignment failed - print $bar $zz + typeset -p bar zz } - () { typeset -n foo; foo=zz; local zz; foo=zz; print $bar $zz } + # prior to workers/53676 the assignment failed + unset zz + () { typeset -n foo; foo=zz; local zz; foo=zz; typeset -p bar zz } 0:regression: local nameref may not in-scope a global parameter F:previously this could create an infinite recursion and crash ->xx ->xx zz -*?*foo: assignment failed +>typeset -g bar=xx +>typeset -g zz=zz +>typeset -g bar=xx +>typeset zz=zz typeset -nm foo=bar 1:create nameref by pattern match not allowed |
