about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/builtin.c4
-rw-r--r--Test/D04parameter.ztst5
3 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8248e9b12..d66451df1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-08-09  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 26027: Src/builtin.c: fix retying variables in opposite
+	order (should be an error).
+
 	* 36025:Src/Zle/zle_tricky.c: Catch another case of context in
 	get_comp_string():  after "foo=bar; setopt " we didn't recognise
 	"setopt" as the command.  Attempt to do this without actually
diff --git a/Src/builtin.c b/Src/builtin.c
index 34bad035d..c63be7e81 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2674,7 +2674,9 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	    && (locallevel == pm->level || !(on & PM_LOCAL))) {
 	    if (pm->node.flags & PM_TIED) {
 		unqueue_signals();
-		if (!strcmp(asg->name, pm->ename)) {
+		if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
+		    zwarnnam(name, "already tied as non-scalar: %s", asg0.name);
+		} else if (!strcmp(asg->name, pm->ename)) {
 		    /*
 		     * Already tied in the fashion requested.
 		     */
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 0a9e2530c..c7d506a51 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1069,6 +1069,11 @@
 >a:b a b
 >x:y:z
 
+  typeset -T tied1 tied2 +
+  typeset -T tied2 tied1 +
+1:Attempts to swap tied variables are safe but futile
+?(eval):typeset:2: already tied as non-scalar: tied2
+
   string='look for a match in here'
   if [[ ${string%%(#b)(match)*} = "look for a " ]]; then
     print $match[1] $mbegin[1] $mend[1] $string[$mbegin[1],$mend[1]]