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

Re: Bugreport: completion hanging at ubo<Tab> - endless loop



On Wed, 23 Feb 2011 11:30:04 +0000
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Wed, 23 Feb 2011 11:50:18 +0100
> Michael Prokop <news@xxxxxxxxxxxxxxxxx> wrote:
> > in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=353863
> > Sebastien Desreux reported a bug about zsh with its
> > completion system in a specific situation.
> > 
> > To trigger the bug (at least 4.3.10 and 4.3.11 in Debian are
> > known to be affected by this bug):
> > 
> >   zsh -f
> >   autoload -Uz compinit; compinit; alias ubox=ls
> >   ubo<tab>
> > 
> > Then the zsh process is hanging in an endless loop, eating CPU.
> 
> I think the answer might be never to expand aliases when the "x" would
> be added to the command word.  That might be easier said than done.

Looks like this is my fault.  There's code to stop lexical processing
when we've got to the cursor position, which means the alias never gets
expanded, but when I upgraded the interface I missed the fact that it
was doing a test of lexflags against 1 and now needs to look for the bit
LEXFLAGS_ZLE.

Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.64
diff -p -u -r1.64 lex.c
--- Src/lex.c	21 Feb 2011 11:32:47 -0000	1.64
+++ Src/lex.c	24 Feb 2011 12:36:41 -0000
@@ -1825,7 +1825,7 @@ exalias(void)
 	    int zp = lexflags;
 
 	    gotword();
-	    if (zp == 1 && !lexflags) {
+	    if ((zp & LEXFLAGS_ZLE) && !lexflags) {
 		if (zshlextext == copy)
 		    zshlextext = tokstr;
 		return 0;

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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