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

Re: zsh eats 100% CPU with completion in /



On Mon, 2 Nov 2009 22:30:08 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> > 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.

Thanks, it looks like that really is the problem and I think the fix is
fine.

We only call xsymlinks() in two places (apart from recursive calls), and in
both we initialise xbuf to contain '\0' as the first character.  So on the
first time through (!*xbuf) is the standard case, and this was being
handled by searching backwards through memory for the first "/".  So the
bug you've found is a major one.

The code around here is dependent (without checking) on paths being shorter
than PATH_MAX (the factor of 2 is for metafication), which is another
long-standing peeve of mine, but that's a completely separate problem.

-- 
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