about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/exec.c2
-rw-r--r--Test/A06assign.ztst18
3 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 52808bea4..67057cb9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
 	* 34065: Src/exec.c, Src/loop.c: following an "if" condition, do
 	not test lastval for ERR_EXIT until a new command is run
 
+	* Takeshi Banse: 34064: Src/exec.c, Test/A06assign.ztst: assignment
+	before command replaces array with export even when KSH_ARRAYS
+
 2014-12-21  Oliver Kiddle  <opk@zsh.org>
 
 	* Daniel Shahaf: 33977: Completion/Zsh/Command/_bindkey:
diff --git a/Src/exec.c b/Src/exec.c
index eaf73df25..6b93008bd 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2294,6 +2294,8 @@ addvars(Estate state, Wordcode pc, int addflags)
 		}
 		allexp = opts[ALLEXPORT];
 		opts[ALLEXPORT] = 1;
+		if (isset(KSHARRAYS))
+		    unsetparam(name);
 	    	pm = assignsparam(name, val, myflags);
 		opts[ALLEXPORT] = allexp;
 	    } else
diff --git a/Test/A06assign.ztst b/Test/A06assign.ztst
index 3c9ea0837..0ad9a0aca 100644
--- a/Test/A06assign.ztst
+++ b/Test/A06assign.ztst
@@ -433,3 +433,21 @@
 >n=(tmpfile1 tmpfile2)
 >typeset x=tmpfile2
 >typeset -E f=4.000000000e+00
+
+ A=(first second)
+ A="${A[*]}" /bin/sh -c 'echo $A'
+ print -l "${A[@]}"
+0:command execution with assignments shadowing array parameter
+>first second
+>first
+>second
+
+ setopt ksharrays
+ A=(first second)
+ A="${A[*]}" /bin/sh -c 'echo $A'
+ print -l "${A[@]}"
+ unsetopt ksharrays
+0:command execution with assignments shadowing array parameter with ksharrays
+>first second
+>first
+>second