mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
44664: Fix problem with temporary assignment.
"foo=bar builtin" inside a function lost any variable from enclosing scope.
This commit is contained in:
parent
4fae525726
commit
d946f22a4c
3 changed files with 21 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2019-08-14 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 44664: Src/params.c, Test/D04parameter.ztst: Ensure
|
||||
temporary assignment around builtin in function doesn't
|
||||
trash global variable.
|
||||
|
||||
2019-08-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 44635: Src/exec.c: don't apply STAT_NOPRINT to backgrounded
|
||||
|
|
|
@ -1124,8 +1124,10 @@ copyparam(Param tpm, Param pm, int fakecopy)
|
|||
tpm->base = pm->base;
|
||||
tpm->width = pm->width;
|
||||
tpm->level = pm->level;
|
||||
if (!fakecopy)
|
||||
if (!fakecopy) {
|
||||
tpm->old = pm->old;
|
||||
tpm->node.flags &= ~PM_SPECIAL;
|
||||
}
|
||||
switch (PM_TYPE(pm->node.flags)) {
|
||||
case PM_SCALAR:
|
||||
tpm->u.str = ztrdup(pm->gsu.s->getfn(pm));
|
||||
|
|
|
@ -2522,3 +2522,15 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
|
|||
>trailing/slashes
|
||||
>removed
|
||||
>are/removed
|
||||
|
||||
foo=global-value
|
||||
fn() {
|
||||
local foo=function-value
|
||||
foo=export-value true
|
||||
print $foo
|
||||
}
|
||||
fn
|
||||
print $foo
|
||||
0:Global variables are not trashed by "foo=bar builtin" (regression test)
|
||||
>function-value
|
||||
>global-value
|
||||
|
|
Loading…
Reference in a new issue