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

Re: Bug: zsh crashed when completing with pattern



> It's the parse of the _arguments argument that's at fault. 
> Patch below fixes the core dump, but your _arguments syntax is
> wrong.  The colons separate parts of the argument spec, so you need to
> protect any that are part of the pattern.
>
> Also, do you perhaps mean [[\:digit\:]] ?

Yes, that's what I mean, I have no idea on zsh pattern writing...

> Note, I'm not 100% sure that the patched test for endpat shouldn't be
>     (!endpat || pattry(endpat,line))
> but it doesn't seem to make any difference.  Anyone?

After digging into code, I find that it's because zsh failed to compile the pattern.

Src/Zle/computil.c#L2356
	    endpat = patcompile(state.def->end, 0, NULL);

I did some debug and found that endpat is NULL, which should mean the compilation
failed. Note, another pattern compilation at L2341 should also be considered.
I think zsh should throw an error when zsh fails to compile state.def->end, so that
following code is aborted; or silently treat wrong pattern as no pattern, in this case,
state.def->end && endpat && pattry(endpat, line) should be used to keep
completing current argument.



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