Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh eats 100% CPU with completion in /
- X-seq: zsh-workers 27337
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: zsh eats 100% CPU with completion in /
- Date: Mon, 2 Nov 2009 22:06:51 +0100
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=SG57YuNaxwr6H78Tc3VwiUOKwYcu6xoCbdG5vvKpg/Y=; b=O+h9Fp0ynfRp0nO+eZUjH8gAqMog4F3HCSs4WE0+MdECp/oWyMGajdC7SE2jgkXTFW P+XuzUz/X59jm3cO1kdy3DIdVnzs36qD/7pDzusxop4Qx+Y8qLK5IpSCYqFTOdJtlQsy nBpEhu87en8zQbv1p0/cdYDxmNs/yBgCDR2EA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=unB4izHhe28/lbNsmCrWXU5nk2nLQLAVo0OipUYI4ZKlu2X4MywLzy/rSVixsop1Qi vYmrg1InGd9l3m5memErtqU5ttzZ0BwCElG7FxY6HqWTRenB0bWu5lBbeLHex5A/O5By qyLesCyl/8ZoJ6LZ+VnpI2OyRjtYSB92HSvEY=
- In-reply-to: <237967ef0911021258x5403c976m281fb66ee7488b59@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <mikachu@xxxxxxxxx> <237967ef0911011312u307ecf19kbabf9fecf867cec1@xxxxxxxxxxxxxx> <200911012220.nA1MKgjM005270@xxxxxxxxxxxxxxxxxxx> <237967ef0911011657n54279c54ja8fce16a1861ff4f@xxxxxxxxxxxxxx> <237967ef0911011726q7550593ax30bc61f1a736e725@xxxxxxxxxxxxxx> <20091102163858.11415153@news01> <237967ef0911021258x5403c976m281fb66ee7488b59@xxxxxxxxxxxxxx>
2009/11/2 Mikael Magnusson <mikachu@xxxxxxxxx>:
> Here we are,
>
> (gdb) watch lextok2['/']
> Hardware watchpoint 9: lextok2['/']
> Continuing.
> Hardware watchpoint 9: lextok2['/']
>
> Old value = 47 '/'
> New value = 0 '\000'
> 0x080c962f in xsymlinks (s=0x818e8f1 "..") at utils.c:696
> 696 *p = '\0';
>
> (start over and add breakpoints (i'm not in reversible now just to be safe))
>
> 692 if (!strcmp(xbuf, "/"))
> (gdb) print xbuf
> $22 = '\000' <repeats 8191 times>
> (gdb) n
> 694 p = xbuf + strlen(xbuf);
> (gdb)
> 695 while (*--p != '/');
> (gdb) n
> at this point i pressed ctrl-c because i was curious what was taking
> so long. Apparently this loops over all memory until it finds a slash,
> which takes a while under gdb. Also apparently, the first / it finds
> is in lextok2.
And this seems to fix it. Not sure if checking that inside the loop is the best
place, but there seems to be some freeing of *pp going on that I
didn't feel like
investigating. Maybe checking xbuf before slashsplit would work?
diff --git a/Src/utils.c b/Src/utils.c
index 2a05624..634edc5 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -691,6 +691,8 @@ xsymlinks(char *s)
zsfree(*pp);
if (!strcmp(xbuf, "/"))
continue;
+ if (!*xbuf)
+ continue;
p = xbuf + strlen(xbuf);
while (*--p != '/');
*p = '\0';
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author