Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in built-in 'test' under cont $CONTEXT



On Wed, 01 Jul 2009 07:06:09 +0900
Takahiro SUZUKI <takahiro.suzuki.ja@xxxxxxxxx> wrote:
> I found a bug in builtin test command under $CONTEXT=="cont".
> 
> Using builtin test command via zle widget when zsh is pending for "for",
> the shell fails with segmentation fault. This does not occur when using
> /usr/bin/test instead, so I guess it is a problem of zsh.

Thanks, this made it very quick to work out what was going on.

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.227
diff -u -r1.227 builtin.c
--- Src/builtin.c	20 May 2009 09:53:22 -0000	1.227
+++ Src/builtin.c	1 Jul 2009 08:57:30 -0000
@@ -5812,12 +5812,14 @@
 	}
     }
 
+    lexsave();
     testargs = argv;
     tok = NULLTOK;
     condlex = testlex;
     testlex();
     prog = parse_cond();
     condlex = zshlex;
+    lexrestore();
 
     if (errflag) {
 	errflag = 0;


-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author