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

Re: [PATCH] Fix an issue where SIGINT leaves readhistfile in inconsistent state

On Sat, 2019-02-16 at 23:40 -0500, Yutian Li wrote:
> The issue I encountered is, when Zsh receives a SIGINT, it sets
> errflag |= ERRFLAG_INT so it will break out of the loop in
> readhistfile. But before we entered this loop we have already set
> lasthist.fsiz = sb.st_size and lasthist.mtim = sb.st_mtime so it looks
> like we have processed the history file up to the end already. And
> next time readhistfile is called, it will skip all processing and
> assume we have the entire history. This leaves Zsh in an inconsistent
> state, where history from different sessions could be lost.
> My proposed fix is to just add another flag to tell us if we've been
> interrupted from last time. If so, we don't skip processing.

That seems fine --- it looks like it ought to be safe.  I've committed


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