zsh-users
 help / color / mirror / code / Atom feed
* histroy file being truncated (konsole with multiple shells context)
@ 2004-07-04 10:40 Samuel Krempp
  2004-07-04 17:22 ` Peter Stephenson
  2004-09-29 23:03 ` Wayne Davison
  0 siblings, 2 replies; 5+ messages in thread
From: Samuel Krempp @ 2004-07-04 10:40 UTC (permalink / raw)
  To: zsh-users

I noticed some people already noticed that kind of unreproduced
behaviour ("vanishing history", 
http://www.zsh.org/mla/users/2002/msg00105.html )

It's becoming very frequent for me, with 3 or 4 zsh shells inside a
konsole (kde's advanced console for those that are not familiar with
kde), and zsh history set with 
HISTSIZE=99000
SAVEHIST=90000

I get truncated $HISTFILE files from time to time, and then there are
several
$HISTFILE.<number> empty files created (with the numbers certainly being
the PIDs of the shells whose history was being written, I guess)


konsole gives the shell 1s to shut down before killing it.
So I guess zsh starts writing a new history file when shutting down, and
if it is stopped before the end, the file ends-up truncated.

Shouldn't zsh be cautious about that, and use some safe commit idiom ?
(i.e. write the new file $HISTFILE.new, then commit the swap of it with
the old $HISTFILE in an atomic way)

BTW, how does incappendhistory works ?  is the history written at each
and every command, even if it means rewriting it completely every time ?

I'm using zsh a lot, and I'd really like to be able to rely on its
history for automatically archiving complicated commands and parameter
sets, with no risk of loosing any command.

In the case of very big $HISTFILE, it seems to me the best solution to
insure all commands end-up in the $HISTFILE even in case of brutal
shutdown is for each zsh to write incremental temporary histfiles (by
plain appending), then merging them (with a safe commit method) into the
final $HISTFILE at regular intervals.
zsh can then check for these files at startup, and do the merging of any
temporary files pending from last session.

A scheme like that should be both efficient and reliable, right ?

-- 
Sam


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-09-30  8:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-04 10:40 histroy file being truncated (konsole with multiple shells context) Samuel Krempp
2004-07-04 17:22 ` Peter Stephenson
2004-09-29 23:03 ` Wayne Davison
2004-09-30  4:39   ` Bart Schaefer
2004-09-30  8:35     ` history " Samuel Krempp

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