diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2011-03-01 05:18:15 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2011-03-01 05:18:15 +0000 |
commit | 6e50d3d7dbed4adb01f71de823dda2a6ee5442f3 (patch) | |
tree | 5cad214d407a222a8c38e6cff60e881cb93351a1 /Src | |
parent | 503589272556fe9c8b582c7c1b56fcefcd42bbc5 (diff) | |
download | zsh-6e50d3d7dbed4adb01f71de823dda2a6ee5442f3.tar.gz zsh-6e50d3d7dbed4adb01f71de823dda2a6ee5442f3.tar.xz zsh-6e50d3d7dbed4adb01f71de823dda2a6ee5442f3.zip |
28823: make it an error to tie the same scalar to two different arrays
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index aa87dfb7d..6dbfa75ca 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2420,12 +2420,12 @@ bin_typeset(char *name, char **argv, Options ops, int func) } if (!strcmp(asg0.name, asg->name)) { 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; } if (strchr(asg0.name, '[') || strchr(asg->name, '[')) { unqueue_signals(); - zerrnam(name, "can't tie array elements"); + zerrnam(name, "can't tie array elements: %s", asg0.name); return 1; } /* @@ -2440,6 +2440,11 @@ bin_typeset(char *name, char **argv, Options ops, int func) if ((pm = (Param) paramtab->getnode(paramtab, asg0.name)) && !(pm->node.flags & PM_UNSET) && (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))) oldval = ztrdup(getsparam(asg0.name)); on |= (pm->node.flags & PM_EXPORTED); |