* vanishing history
@ 2001-11-28 16:19 Adam Spiers
2002-02-16 9:28 ` Wayne Davison
0 siblings, 1 reply; 2+ messages in thread
From: Adam Spiers @ 2001-11-28 16:19 UTC (permalink / raw)
To: zsh users mailing list
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 have the following settings:
HISTSIZE=3000
cshjunkiehistory
extendedhistory
histallowclobber
histexpiredupsfirst
histignorealldups
histignoredups
histreduceblanks
histverify
incappendhistory
I'm running 4.1.0-dev-2 from CVS. I have a _very_ vague suspicion
that it might be something to do with running different versions of
zsh on the same history file, or maybe zcompile comes into it somehow,
but really I haven't a clue. I wanted to get my .zshrc to
automatically alert me when it happens, via:
_check_hist_size () {
fc_out=( $(fc -l -1) )
if (( "$fc_out[1]" < 500 )); then
print "\nWARNING: Small history ($fc_out[1]) detected\!"
fi
}
but that just resulted in:
_check_hist_size:fc:1: no such event: 0
_check_hist_size:2: no such file or directory: 500
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: vanishing history
2001-11-28 16:19 vanishing history Adam Spiers
@ 2002-02-16 9:28 ` Wayne Davison
0 siblings, 0 replies; 2+ messages in thread
From: Wayne Davison @ 2002-02-16 9:28 UTC (permalink / raw)
To: Adam Spiers; +Cc: zsh users mailing list
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..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-02-16 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-28 16:19 vanishing history Adam Spiers
2002-02-16 9:28 ` Wayne Davison
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).