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

Re: segfault via completion menu

On Wed, 2019-05-22 at 09:49 +0100, Peter Stephenson wrote:
> On Tue, 2019-05-21 at 15:19 -0700, Bart Schaefer wrote:
> It'll be something in the prog passed into pattry() from evalcond() and
> I'm guesing in this case the pprog in that function came from
> stat->prog->pats[npat] so was fished out of the existing programme
> rather than compiled locally.

If so, something in the following assumptions is being violated, but I
can't see what from looking at the code.

- Whenever we initialise or copy pats[*] we set it to point to a dummy
pattern, ensuring we recompile the pattern next time.

- If we compile the pattern, we only save it if the code it's
being saved into is not on the heap.  (Which it shouldn't be
here, as this is a shell function.)

- If we save it we always use permanent memory.

Possibly adding some debug flags to check the heapiness of patterns at
various points might show something.  (Guess we should check it
is coming from a previously saved version rather than a newly
compiled version, though I don't see how the latter could cause
a crash.)


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