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

Re: zsh eats 100% CPU with completion in /



2009/11/2 Mikael Magnusson <mikachu@xxxxxxxxx>:
> 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?

And of course, I have no idea if *xbuf being '\0' is indicative of
some other bug.

-- 
Mikael Magnusson



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