about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Unix/Command/_perforce2
-rw-r--r--Src/exec.c6
-rw-r--r--Test/A06assign.ztst4
-rw-r--r--Test/C03traps.ztst11
5 files changed, 24 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index f80e1a5c7..da6c87e89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-13  Peter Stephenson  <pws@csr.com>
+
+	* 30876: Src/exec.c, Test/A06assign.ztst, Test/C03traps.ztst:
+	obscure failures to process non-zero return values could result
+	from optimising a list to a simple command.
+
 2012-12-08  Bart Schaefer  <schaefer@zsh.org>
 
 	* users/17445: Src/math.c, Test/C01arith.ztst: fix handling of
@@ -368,5 +374,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5766 $
+* $Revision: 1.5767 $
 *****************************************************
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index 78f6cd71e..d2943472c 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -2019,7 +2019,7 @@ _perforce_cmd_fix() {
     '-s[set job status]:status:_perforce_statuses' \
     '1::-c required:(-c)' \
     '2::change:_perforce_changes' \
-    "3::job:_perforce_jobs$job"
+    "*::job:_perforce_jobs$job"
 }
 
 
diff --git a/Src/exec.c b/Src/exec.c
index 74b14d54d..1ecbc3967 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1207,6 +1207,9 @@ execlist(Estate state, int dont_change_job, int exiting)
 	} else
 	    donedebug = intrap ? 1 : 0;
 
+	/* Reset donetrap:  this ensures that a trap is only *
+	 * called once for each sublist that fails.          */
+	donetrap = 0;
 	if (ltype & Z_SIMPLE) {
 	    next = state->pc + WC_LIST_SKIP(code);
 	    if (donedebug != 2)
@@ -1214,9 +1217,6 @@ execlist(Estate state, int dont_change_job, int exiting)
 	    state->pc = next;
 	    goto sublist_done;
 	}
-	/* Reset donetrap:  this ensures that a trap is only *
-	 * called once for each sublist that fails.          */
-	donetrap = 0;
 
 	/* Loop through code followed by &&, ||, or end of sublist. */
 	code = *state->pc++;
diff --git a/Test/A06assign.ztst b/Test/A06assign.ztst
index 84500f605..9a0a4f0cc 100644
--- a/Test/A06assign.ztst
+++ b/Test/A06assign.ztst
@@ -184,8 +184,8 @@
 
  typeset -A hash
  hash=(one 1)
- h+=string
- [[ $h[@] == string ]]
+ hash+=string
+ [[ $hash[@] == string ]]
 0:add scalar to association
 
 # tests of var+=(array)
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 321f5e956..757f75ca4 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -388,6 +388,17 @@
 >}
 >No, really exited
 
+   (set -e
+    printf "a\nb\n" | while read line
+    do
+       [[ $line = a* ]] || continue
+       ((ctr++))
+       [[ $line = foo ]]
+    done
+    echo "ctr = $ctr"
+   )
+1:ERREXIT in loop with simple commands
+
 %clean
 
   rm -f TRAPEXIT