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

Re: zsh history gets destroyed when running out of disk space

* Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> [20070622 22:31]:
> On Thu, 21 Jun 2007 10:04:54 +0200 Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> > Michael Prokop <news@xxxxxxxxxxxxxxxxx>:

> > > Problem:
> > > Zsh truncates the zsh history file if you are running out of disk
> > > space (AKA ENOSPC). If you don't have any space left in your $HOME
> > > and exit zsh you'll find an empty $HISTFILE left.

> > Hey, I experienced just the same a few days back. So, I also think
> > this should be addressed.

> The following detects errors during writing better.  If you're writing a
> new file it'll leave it wherever it gets to; if you're replacing an old
> file it will leave the old file alone.  That's about the best we can do.
> I haven't tested this on a failure, but it should be better than what
> we've got.

Verified, works.

Exiting shell quits with:

| zsh: failed to write history file /home/grml/.zsh_history.new: unknown error 1182546552

and an empty /home/grml/.zsh_history.new file is left. My original
/home/grml/.zsh_history is left untouched (no truncating anymore).
During a shell session the history file is getting longer only as
long as there a free bits left (as you intented to). The error code
might be improved though. ;)

 ,'"`.         http://www.michael-prokop.at/
(  grml.org -» Linux Live-CD for texttool-users and sysadmins
 `._,'         http://www.grml.org/

Attachment: signature.asc
Description: Digital signature

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