mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-19 03:31:14 +02:00
28823: make it an error to tie the same scalar to two different arrays
This commit is contained in:
parent
5035892725
commit
6e50d3d7db
2 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2011-02-28 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* 28823: Src/builtin.c: make it an error to tie the same scalar to
|
||||||
|
two different arrays (prevents crash bug); improve a couple of
|
||||||
|
other error messages.
|
||||||
|
|
||||||
2011-02-28 Peter Stephenson <pws@csr.com>
|
2011-02-28 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
* Frank, 28812, modified as in 28813: Src/string.c: wcs_ztrdup()
|
* Frank, 28812, modified as in 28813: Src/string.c: wcs_ztrdup()
|
||||||
|
@ -14270,5 +14276,5 @@
|
||||||
|
|
||||||
*****************************************************
|
*****************************************************
|
||||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.5210 $
|
* $Revision: 1.5211 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
|
@ -2420,12 +2420,12 @@ bin_typeset(char *name, char **argv, Options ops, int func)
|
||||||
}
|
}
|
||||||
if (!strcmp(asg0.name, asg->name)) {
|
if (!strcmp(asg0.name, asg->name)) {
|
||||||
unqueue_signals();
|
unqueue_signals();
|
||||||
zerrnam(name, "can't tie a variable to itself");
|
zerrnam(name, "can't tie a variable to itself: %s", asg0.name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (strchr(asg0.name, '[') || strchr(asg->name, '[')) {
|
if (strchr(asg0.name, '[') || strchr(asg->name, '[')) {
|
||||||
unqueue_signals();
|
unqueue_signals();
|
||||||
zerrnam(name, "can't tie array elements");
|
zerrnam(name, "can't tie array elements: %s", asg0.name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -2440,6 +2440,11 @@ bin_typeset(char *name, char **argv, Options ops, int func)
|
||||||
if ((pm = (Param) paramtab->getnode(paramtab, asg0.name))
|
if ((pm = (Param) paramtab->getnode(paramtab, asg0.name))
|
||||||
&& !(pm->node.flags & PM_UNSET)
|
&& !(pm->node.flags & PM_UNSET)
|
||||||
&& (locallevel == pm->level || !(on & PM_LOCAL))) {
|
&& (locallevel == pm->level || !(on & PM_LOCAL))) {
|
||||||
|
if (pm->node.flags & PM_TIED) {
|
||||||
|
unqueue_signals();
|
||||||
|
zerrnam(name, "can't tie already tied scalar: %s", asg0.name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (!asg0.value && !(PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED)))
|
if (!asg0.value && !(PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED)))
|
||||||
oldval = ztrdup(getsparam(asg0.name));
|
oldval = ztrdup(getsparam(asg0.name));
|
||||||
on |= (pm->node.flags & PM_EXPORTED);
|
on |= (pm->node.flags & PM_EXPORTED);
|
||||||
|
|
Loading…
Reference in a new issue