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

Re: zsh 5.3.1 crashes on completion

On May 15, 10:28am, Peter Stephenson wrote:
} Subject: Re: zsh 5.3.1 crashes on completion
} On Sat, 13 May 2017 11:23:13 -0700
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > The crash occurs when the history in the subshell is updated to remove
} > the duplicate of the previous command.  Adding new history events is
} > disabled in subshells so the new event that is supposed to replace the
} > old one does not exist, and the code wanders off into neverland.
} I suppose removing duplicates could be disabled in subshells as well?

It's a bit more subtle than that.  The current history line (chline)
is actually pointing into the previous event, which is being taken as
a duplicate of *itself*.

One tangent seems to be that in a subshell, "save" in hend() ought to
become zero, because we never (?) want to write out the history of a
subshell.  But without resorting to another hack on zsh_subshell like
I did in entersubsh(), I don't know how to tell in hend() that the
history doesn't need to be saved.

The reason this crashes in completion seems to be that loop() is being
called before ZLE exits, so the parent loop() is still "open" and no
previous call to hend() has been done.  Otherwise this would fail on
*any* use of `r`.  (Expand-word will trip the bug as well.)

So maybe, really, loop() needs an entry point that doesn't use hbegin()
and hend().  Or maybe that's overkill.  Like I said, I don't know at
which of all these places to apply a fix.

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