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

Re: segfault in 3.1.6 in completion



Greg Klanderman wrote:

> Start 3.1.6 with no init files and load the below attached completion
> functions.  Now if you go into a directory containing CVS controlled
> files and try
> 
>   % cvstest foobar/
> 
> (where foobar is some directory) and hit TAB you get a crash 
> 
> Program received signal SIGSEGV, Segmentation fault.

Oops. compctl didn't stay up-to-date with respect to optimised
match-storing.

And then there was the problem that the display list wasn't stored.

Bye
 Sven

diff -ru ../z.old/Src/Zle/compctl.c Src/Zle/compctl.c
--- ../z.old/Src/Zle/compctl.c	Thu Feb 24 09:54:17 2000
+++ Src/Zle/compctl.c	Thu Feb 24 10:32:41 2000
@@ -3763,10 +3763,11 @@
 	    for (ln = firstnode(matches); ln; ln = nextnode(ln)) {
 		m = (Cmatch) getdata(ln);
 		if (m->ppre) {
+		    char *s = (m->psuf ? m->psuf : "");
 		    char *p = (char *) zhalloc(strlen(m->ppre) + strlen(m->str) +
-					      strlen(m->psuf) + 1);
+					      strlen(s) + 1);
 
-		    sprintf(p, "%s%s%s", m->ppre, m->str, m->psuf);
+		    sprintf(p, "%s%s%s", m->ppre, m->str, s);
 		    addlinknode(args, dupstring(p));
 		} else
 		    addlinknode(args, dupstring(m->str));
@@ -3799,6 +3800,9 @@
 		endcmgroup(yaptr);
 		begcmgroup("default", 0);
 	    }
+	} else {
+	    endcmgroup(yaptr);
+	    begcmgroup("default", 0);
 	}
     } else if ((tt = cc->explain)) {
 	tt = dupstring(tt);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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