Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: zsh crashed when completing with pattern
> 2026/02/23 15:21、Ma Rocket <ma2014119@xxxxxxxxxxx>のメール:
>
> 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.
In addition to lines 2341 and 2356 in Zle/computil.c, there are (at least)
two places where the return value of patcompile() is not checked properly.
(1) module.c:3044
core dump by:
% zmodload zsh/attr
% zmodload -Fml zsh/attr '['
(2) Zle/complete.c:968, 981
core dump by:
% compdef "compset -N '['" foo
% foo <TAB>
I'm not sure whether zsh should issue an error or just consider 'nothing
matches with a broken pattern'.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author