about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Src/builtin.c9
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 95e709e8f..a69dfee8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* 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
-* $Revision: 1.5210 $
+* $Revision: 1.5211 $
 *****************************************************
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);