about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Src/builtin.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 61ccab6cd..6464af43f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-01  Peter Stephenson  <pws@csr.com>
+
+	* 27079: Src/builtin.c: test builtin uses parser and so should
+	save and restore the lexical context to avoid pulling the
+	rug out when called in some nested fashion.
+
 2009-06-28  Andrey Borzenkov <bor@zsh.org>
 
 	* unposted: Completion/Unix/Command/_man:
@@ -11870,5 +11876,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4720 $
+* $Revision: 1.4721 $
 *****************************************************
diff --git a/Src/builtin.c b/Src/builtin.c
index 60e81caa4..01e6b479b 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5812,12 +5812,14 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
 	}
     }
 
+    lexsave();
     testargs = argv;
     tok = NULLTOK;
     condlex = testlex;
     testlex();
     prog = parse_cond();
     condlex = zshlex;
+    lexrestore();
 
     if (errflag) {
 	errflag = 0;