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

Bug in completion with menucomplete and no insertion



I was just testing the closing-stdin code and I got a command wrong and it
caused a (repeatable) crash.  Then I found it works even if I got the
command right(ish).

What I tried first was

% _foo() { compgen -s; }              # mistake, of course
% compdef _foo foo
% foo <TAB>
compgen: command string expected after -s
+4:53% foo
compgen: command string expected after -s

Hitting up arrow and immediately typing any insertion key causes the shell
to crash every time.  Then I found it did the same with

% _foo() { compgen -s ''; }

(except it was a little more erratic getting it to crash).

Presumably something nasty is happening to memory somewhere before that
point.  I checked and it's not even specific to -s: other mistakes in the
get_compctl() called from bin_compgen() do the same thing.  The common
factor seems to be that none of the commands produce matches or insert
anything.  It seems to need menucomplete set as well; I've reproduced it
after zsh -f, compinit, setopt nobeep menucomplete (nobeep is only
necessary for sanity).

Maybe more will turn up after I compile the new version on a system where I
can use mem-debug.

By the way, I've applied the following trivial patch to zle_tricky.c
for shared-library purposes.

--- Src/Zle/zle_tricky.c.csu	Mon Jun  7 13:29:37 1999
+++ Src/Zle/zle_tricky.c	Mon Jun  7 14:43:00 1999
@@ -5077,7 +5077,7 @@
 	}
 	compquote = ztrdup(compquote);
 	compquoting = ztrdup(compquoting);
-	comp_setunset(0, 0, set, unset);
+	comp_setunsetptr(0, 0, set, unset);
 
 	if (unset(COMPLETEINWORD)) {
 	    untokenize(ns);


-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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