zsh-users
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Vincent Lefevre <vincent@vinc17.org>
Cc: <zsh-users@sunsite.dk>
Subject: Re: [4.0.2 bug] commands not written to history
Date: Tue, 7 Aug 2001 12:46:34 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.33L2.0108071235060.3311-200000@phong.blorf.net> (raw)
In-Reply-To: <4a9256987fvincent@vinc17.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 981 bytes --]

On Fri, 29 Jun 2001, Vincent Lefevre wrote:
> It seems that cmd2 simply disappeared from the history; cmd2 probably
> was the last command I typed in the shell, then I logged out, and
> logged in again (thus, the xinit in the history just after cmd1).

I was finally able to reproduce a case where the shell failed to save
the very last command in the history.  It only occurs when the Zle
history is active and the shell gets a signal that causes it to die.
In these circumstances, the save-history code is subtracting 1 from
the maximum number of events that it will save (so that the last,
unfinished line is not written out), but since the code is really
rewriting the history file using an alternate history buffer, the
real result is that it loses the last line in the just-read data.

So, do you know if you were exiting the shell via some kind of signal
rather than typing something like "exit"?  If so, try the attached
patch and see if this fixes the problem.

..wayne..

[-- Attachment #2: fix last-line lossage --]
[-- Type: TEXT/PLAIN, Size: 837 bytes --]

Index: Src/hist.c
--- Src/hist.c	2001/06/28 18:17:14	1.30
+++ Src/hist.c	2001/08/07 19:32:59
@@ -2028,10 +2028,13 @@
 	    Histent remember_hist_ring = hist_ring;
 	    int remember_histlinect = histlinect;
 	    int remember_curhist = curhist;
+	    int remember_histsiz = histsiz;
+	    int remember_histactive = histactive;
 
 	    hist_ring = NULL;
 	    curhist = histlinect = 0;
 	    histsiz = savehist;
+	    histactive = 0;
 	    createhisttable(); /* sets histtab */
 
 	    hist_ignore_all_dups |= isset(HISTSAVENODUPS);
@@ -2044,6 +2047,8 @@
 	    histlinect = remember_histlinect;
 	    hist_ring = remember_hist_ring;
 	    histtab = remember_histtab;
+	    histsiz = remember_histsiz;
+	    histactive = remember_histactive;
 	}
     } else if (err)
 	zerr("can't write history file %s", fn, 0);

  parent reply	other threads:[~2001-08-07 19:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-29 14:33 Vincent Lefevre
2001-06-29 15:50 ` Bart Schaefer
2001-06-29 18:14   ` Vincent Lefevre
2001-06-30 16:06     ` Bart Schaefer
2001-07-02 10:42       ` Vincent Lefevre
2001-07-11 22:34       ` Vincent Lefevre
2001-07-11 23:59         ` Vincent Lefevre
2001-07-12  3:30           ` Bart Schaefer
2001-07-12 12:43             ` Vincent Lefevre
2001-07-12 17:46               ` Bart Schaefer
2001-07-12 20:38                 ` Vincent Lefevre
2001-07-12 20:58                 ` Wayne Davison
2001-07-13 18:07                   ` Bart Schaefer
2001-08-07 19:46     ` Wayne Davison [this message]
2001-08-07 20:39       ` Vincent Lefevre
2001-07-21 13:44 ` Vincent Lefevre

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.0108071235060.3311-200000@phong.blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=vincent@vinc17.org \
    --cc=zsh-users@sunsite.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).