about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-07-01 09:07:07 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-07-01 09:07:07 +0000
commit10787467bc268079951b997b8605dd51cc9047a2 (patch)
tree1ecafb4a4506324a561dda5d35ef43476bb76a7a
parent486c21ad3a5530535f2c572c81b68548d628d675 (diff)
downloadzsh-10787467bc268079951b997b8605dd51cc9047a2.tar.gz
zsh-10787467bc268079951b997b8605dd51cc9047a2.tar.xz
zsh-10787467bc268079951b997b8605dd51cc9047a2.zip
27079: save lexical context in test builtin
-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;