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

Re: segfault on repeated tab completion after menu selection



Christian Taylor wrote:
> Hi,
> 
> I use zsh 4.2.6 on Linux (vanilla 2.6.17.7 kernel). Under the following 
> circumstances I can reliably produce a segfault:
> 
> % zsh -f
> % autoload -U compinit; compinit
> % bindkey '+' accept-and-infer-next-history
> % zstyle ':completion:*' menu select yes=long
> % zstyle ':completion:*:warnings' format 'No matches for: %d'
> 
> % cd <some directory with files/subdirectories in it>
> % mkdir xyz
> % ls <TAB><TAB>
> >From the menu, select the empty xyz directory, hit "+". zsh accepts the 
> selection and says that there are no further matches in that directory.
> At this point, pressing either "+<TAB>" or "<TAB><TAB>" will result in:
> zsh: segmentation fault  zsh -f

That's certainly a bug.

I've had some success with the following patch.  Does this fix it in
your case?  Unfortunately nobody currently has the seventeen years of
postdoctoral studies necessary to understand the code properly.

Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.84
diff -u -r1.84 compcore.c
--- Src/Zle/compcore.c	10 Jul 2006 13:08:24 -0000	1.84
+++ Src/Zle/compcore.c	30 Jul 2006 19:47:43 -0000
@@ -466,12 +466,12 @@
 
     /* If we are doing a menu-completion... */
 
-    if (menucmp && *lst != COMP_LIST_EXPAND && 
+    if (minfo.cur && menucmp && *lst != COMP_LIST_EXPAND && 
 	(menucmp != 1 || !compwidget || compwidget == lastcompwidget)) {
 	do_menucmp(*lst);
 	return 1;
     }
-    if (menucmp && validlist && *lst == COMP_LIST_COMPLETE) {
+    if (minfo.cur && menucmp && validlist && *lst == COMP_LIST_COMPLETE) {
 	showinglist = -2;
 	onlyexpl = listdat.valid = 0;
 	return 1;

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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