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

Re: [PATCH] compdescribe fix for unsorted groups (workers/34814) (was: Re: completion: git: --fixup: problem with _describe -2V and duplicate commit subjects)



Bart Schaefer wrote on Tue, May 19, 2015 at 15:23:00 -0700:
> On May 19,  8:44pm, Daniel Shahaf wrote:
> } Subject: Re: [PATCH] compdescribe fix for unsorted groups (workers/34814) 
> }
> } 3. I propose the following documentation patch:
> } 
> } +tt(_describe) should not be called more than once in a single call to
> } +a completion function.
> 
> Is it really any time _describe is called twice, or is it just that
> _describe should not be called more than once with the same (or an
> overlapping?) set of descriptions?

If you call _describe more than once, with the same tag parameter in
both calls (or with no -t parameter in both calls), and each of the two
calls (separately) has a pair of items with equal description, then the
display will be garbled.  This happens even if no flags (other than
possibly -t) are passed.

I'm not sure whether that's a complete characterization, i.e., whether
there are other circumstances that also trigger the problem.  I think
the trick might be to get cd_get() to pass -E to compadd (inserting an
empty match) twice during one completion operation.

While looking into this, I've also found a 100% CPU consumption bug; to
reproduce (in master):

    autoload compinit
    compinit
    _f() { d=(d1); a=(); compadd -XX -JJ -E1 -d d -a a;  compadd -XX -JJ -E1 -d d -a a }; compdef _f f
    f <TAB><TAB><TAB>

Backtrace:

    0x00007ffff60b7a5d in do_menucmp (lst=4) at compresult.c:1234
    1234		    } while (!(minfo.group)->mcount);
    (gdb) bt
    #0  0x00007ffff60b7a5d in do_menucmp (lst=4) at compresult.c:1234
    #1  0x00007ffff60a2aaf in before_complete (dummy=0x7ffff6516c30, lst=0x7fffffffdd5c) at compcore.c:478
    #2  0x000000000046870f in runhookdef (h=0x7ffff6516c30, d=0x7fffffffdd5c) at module.c:996
    #3  0x00007ffff62f7084 in docomplete (lst=4) at zle_tricky.c:622
    #4  0x00007ffff62f66b7 in expandorcomplete (args=0x7ffff6517188) at zle_tricky.c:315

It's spinning in the outer of the two do-while loops in there, with
minfo.cur being a dummy match.

Cheers,

Daniel



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