zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-workers@zsh.org>
Subject: Re: [PATCH] Fix an issue where SIGINT leaves readhistfile in inconsistent state
Date: Mon, 18 Feb 2019 10:11:39 +0000	[thread overview]
Message-ID: <1550484699.6104.1.camel@samsung.com> (raw)
In-Reply-To: <CABvSBniueJdEVQ8D7EMKsoU2z2FD2M=ecUcuc4gEW4XbwYxajA@mail.gmail.com>

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
it.

Thanks
pws


      reply	other threads:[~2019-02-18 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190217044201epcas4p4ca093a5748a17d62dc9c5d418d0125c1@epcas4p4.samsung.com>
2019-02-17  4:40 ` Yutian Li
2019-02-18 10:11   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550484699.6104.1.camel@samsung.com \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).