Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: revisiting history-file rewriting



On Fri, Mar 18, 2005 at 07:18:25PM +0300, Andrey Borzenkov wrote:
> I have a bunch of [.zsh_history.XXXXXX files]
> with contents like "9354 localhost.localdomain"

You must manually remove them.  I'm curious why you're getting a regular
occurrence of them, though.  Do you not use any of the history-appending
options (e.g. APPEND_HISTORY or SHARE_HISTORY)?  These temp files should
only remain if zsh gets killed while it is waiting for the *.LOCK file,
and a zsh that is appending history will not try to re-write the history
file when it has received a signal telling it to die, so that usually
avoids these droppings.  If no history-appending option is specified,
then having multiple zshs running when the system goes down does tend to
cause these files to be left around.

The locking algorithm has an alternate code section that avoids the
creation of a temporary file, but I think that this alternative might
not be good for NFS (since it relies on O_EXCL).  Perhaps we should
make this locking choice an option instead of conditionally compiled?

This discussion reminded me of why I originally chose to use the name
$HISTFILE.new instead of a unique name for rewriting the history file:
it avoids extra copies of the history file lying around when zsh gets
killed during the rewriting (and since this should only happen if the
user does not have a history-appending option enabled, it doesn't cause
the loss of any extra information that wouldn't have already been lost
by the multiple zsh processes all overwriting each others history
file).

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author