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

Re: core dump while completing: infinite recursion?



On Thu, 27 Dec 2007 21:37:01 +0900
"Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> This bug is first repotred in the "Apple Discussion"
> http://discussions.apple.com/thread.jspa?threadID=1303878&tstart=0
> 
> [1] Problem:
> zsh (sometimes) core dumps if "case-insensitive" and "partial-completion"
> matchings are used simulatneously.

Thanks for the detailed instructions; I got this to happen easily when I
finally looked.

It seems to fix it if we do a "deep" copy of the structures involved at one
point in the code.  The code here is particularly obscure, but I think this
was original done as a matter of efficiency, so this should be OK.

Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.52
diff -u -r1.52 compmatch.c
--- Src/Zle/compmatch.c	28 Nov 2007 21:14:14 -0000	1.52
+++ Src/Zle/compmatch.c	18 Jan 2008 16:23:33 -0000
@@ -2003,8 +2003,8 @@
 	ca = a->prefix;
 
 	while (n) {
-	    e->prefix = cp_cline(n, 0);
-	    a->prefix = cp_cline(ca, 0);
+	    e->prefix = cp_cline(n, 1);
+	    a->prefix = cp_cline(ca, 1);
 
 	    if (anew) {
 		int f = e->flags;

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