zsh-users
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Adam Spiers <adam@spiers.net>
Cc: zsh users mailing list <zsh-users@sunsite.auc.dk>
Subject: Re: vanishing history
Date: Sat, 16 Feb 2002 01:28:25 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.33L2.0202160123440.1473-100000@phong.blorf.net> (raw)
In-Reply-To: <20011128161905.A9726@corelli.new.ox.ac.uk>

On Wed, 28 Nov 2001, Adam Spiers wrote:
> Does anyone have any idea why my .zshhistory occasionally looses the
> vast majority of its contents?  I can't reproduce it, so I can't begin
> to track down what's going on.

I've seen this from time to time, but also have been unable to reproduce
it.  In pouring over the code I did finally see one potential way that
the loss of contents could happen: if the history file is locked by
another process while we're trying to rewrite it.  Here's the fix (which
causes us to just punt on the rewrite if we read nothing):

Index: Src/hist.c
--- Src/hist.c	16 Feb 2002 09:15:07 -0000	1.39
+++ Src/hist.c	16 Feb 2002 09:21:16 -0000
@@ -2083,7 +2083,8 @@
 	    hist_ignore_all_dups |= isset(HISTSAVENODUPS);
 	    readhistfile(fn, err, 0);
 	    hist_ignore_all_dups = isset(HISTIGNOREALLDUPS);
-	    savehistfile(fn, err, 0);
+	    if (histlinect)
+		savehistfile(fn, err, 0);
 	    deletehashtable(histtab);

 	    curhist = remember_curhist;

..wayne..


      reply	other threads:[~2002-02-16  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28 16:19 Adam Spiers
2002-02-16  9:28 ` Wayne Davison [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=Pine.LNX.4.33L2.0202160123440.1473-100000@phong.blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=adam@spiers.net \
    --cc=zsh-users@sunsite.auc.dk \
    /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).