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

PATCH: Re: Very odd behaviour with zsh, maybe corruption bug



On Oct 12,  5:02am, Bart Schaefer wrote:
}
} This *must* be a bug in prefork() called via singsub(); it must be zeroing
} `right' (and thus also zeroing `opat') before copying the string.  But I
} just can't seem to catch it happening.

Having traced through this more closely, which was rather laborious, I
have come to the conclusion that the bug is right there in evalcond(),
and that the following is the fix.  At least, I can't see how this patch
could possibly cause -incorrect- behavior, though it might result in an
optimization being skipped unnecessarily in some cases.

Sven, please dispute this if you can.

Index: Src/cond.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/cond.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 cond.c
--- Src/cond.c	2001/04/09 20:14:12	1.1.1.1
+++ Src/cond.c	2001/10/14 21:48:55
@@ -202,7 +202,7 @@
 		char *opat;
 		int save;
 
-		right = opat = dupstring(ecrawstr(state->prog, state->pc,
+		right = dupstring(opat = ecrawstr(state->prog, state->pc,
 						  &htok));
 		if (htok)
 		    singsub(&right);


-- 
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