Re: history file missing timestamp when HISTFILESIZE reached
From:
Rob Foehl
Subject:
Re: history file missing timestamp when HISTFILESIZE reached
Date:
Mon, 20 Mar 2023 18:27:53 -0400 (EDT)
On Sun, 19 Mar 2023, Grisha Levit wrote:
When HISTTIMEFORMAT is set and history file truncation is performed,
the first line of the history file (i.e. the timestamp of the first
entry) seems to always be missing
For whatever it's worth, I'd noticed history truncation to roughly
HISTSIZE/2 not long after first enabling HISTTIMEFORMAT, and have used
this mnemonic since:
Losing the first timestamp line was a frequent occurrence with unintended
truncation due to a long-standing Fedora default [1], and my guess as to
why was something like:
- load history without HISTTIMEFORMAT set
- append a single command line, with no timestamp
- write last (default) 500 lines of "history" back to disk
Though I never tried to confirm this, being primarily concerned with the
data loss. Also never tried with an odd number for HISTSIZE.