Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [4.0.2 bug] commands not written to history
- X-seq: zsh-users 4092
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Vincent Lefevre <vincent@xxxxxxxxxx>
- Subject: Re: [4.0.2 bug] commands not written to history
- Date: Tue, 7 Aug 2001 12:46:34 -0700 (PDT)
- Cc: <zsh-users@xxxxxxxxxx>
- In-reply-to: <4a9256987fvincent@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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..
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);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author