zsh-users
 help / color / mirror / code / Atom feed
* Bug: Losing .zsh_history
@ 2022-10-05 19:55 Dominik Vogt
  2022-10-05 20:01 ` Eric Cook
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Dominik Vogt @ 2022-10-05 19:55 UTC (permalink / raw)
  To: Zsh Users

Due to some hardware problem with the display adapter my box
sometimes fails to show anything on the screen but just emits some
error beeps while it boots.  Since I cannot log in and stop the
machine without the screen, I can only switch off the power.

It has now happened twice that in the wake of the hard switch-off,
~/.zsh_history got completely erased, replaced with all null
characters, but keeping its size (or at least nor being truncated
to zero size).  This is on Linux 4.x (5.x not being compatible
with the very old hardware) using ext 4 without journal, running
Devuan 4.  Losing history is a real big pain because for me
because it's one huge database of past commands and syntax (2
million lines).

(However, I'm not sure why ~/.zsh_history is modified at all
because it should be touched only when logging in?)

I wonder if this situation could be prevented by changing the code
that writes the history file at exit.  Is truncating the file to
zero size part of the procedure?  When I need to write a file in a
safe manner, the procedure normally looks like this:

 * Create file.new
 * Rename file to file.old
 * Rename file.new to file
 (* Possibly sync filesystem)
 * Erase file.old

--

 $ zsh --version
 zsh 5.8 (x86_64-debian-linux-gnu)

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


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

end of thread, other threads:[~2022-10-07 11:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 19:55 Bug: Losing .zsh_history Dominik Vogt
2022-10-05 20:01 ` Eric Cook
2022-10-05 20:20   ` Dominik Vogt
2022-10-05 21:05     ` Wesley
2022-10-05 21:24       ` Dominik Vogt
2022-10-05 22:31         ` Bart Schaefer
2022-10-05 23:03           ` Dominik Vogt
2022-10-06  4:34             ` Bart Schaefer
2022-10-06  9:40               ` Peter Stephenson
2022-10-06 10:52                 ` Dominik Vogt
2022-10-06 10:30               ` Dominik Vogt
2022-10-05 20:26 ` Dominik Vogt
2022-10-05 22:16 ` Bart Schaefer
2022-10-05 22:32   ` Dominik Vogt
2022-10-06 10:31   ` Dominik Vogt
2022-10-07 11:45 ` Mikael Magnusson

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