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

PATCH: Very serious bug: Bad pattern in precmd()



Try this only in a debugger or if you have another shell from which you
can kill the first one:

zsh% precmd() { echo [[ }

Zsh goes into an infinite loop printing `precmd: bad pattern: [['.  This
does not happen in 3.0.8, but does happen in 3.1.9 (which is the oldest
3.1.x binary I have around).

This appears to have resulted from moving hbegin() to above preprompt()
in loop() -- hbegin() has the side-effect of resetting `errflag = 0'.
This was my fault, all the way back in article 10168, so it's been around
since 3.1.6-dev-20 without anyone catching it.

Index: Src/init.c
===================================================================
diff -c -r1.3 init.c
--- Src/init.c	2001/04/21 22:22:53	1.3
+++ Src/init.c	2001/06/30 17:51:19
@@ -107,7 +107,6 @@
     pushheap();
     for (;;) {
 	freeheap();
-	errflag = 0;
 	hbegin(1);		/* init history mech        */
 	if (isset(SHINSTDIN)) {
 	    setblock_stdin();
@@ -116,6 +115,7 @@
 		stophist = 3;
 		preprompt();
 		stophist = hstop;
+		errflag = 0;
 	    }
 	}
 	intr();			/* interrupts on            */

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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