[Konsole-devel] [Bug 84059] New: zsh shells' history file is sometimes truncated (race condition when killing shells)

Samuel Krempp krempp at crans.ens-cachan.fr
Sat Jun 26 22:08:58 UTC 2004

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
           Summary: zsh shells' history file is sometimes truncated (race
                    condition when killing shells)
           Product: konsole
           Version: unspecified
          Platform: Debian testing
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
        AssignedTo: konsole-devel kde org
        ReportedBy: krempp crans ens-cachan fr

Version:            (using KDE KDE 3.2.2)
Installed from:    Debian testing/unstable Packages
OS:                Linux

It happened many, many times when I shut the computer after many hours of work with half a dozen zsh shells inside konsole sessions.

Sometimes, when I restart, the history file shows all the commands of all the shells were saved (as it should, I think zsh takes care of saving all its instances history to a single file)

But sometimes, the history file is truncated (losing command lines of even previous days), and my homedir shows a few empty $HISTFILE.<pidnumbers> files.

My conclusion is this : 
the truncation means the zsh process is killed while re-writing the history file (it has to rewrite, since some older entries are discarded it cannot just append).
I think konsole doesnt give enough time to the zsh processes to handle its history file before killing them.

Could it be possible for the user to customize the delay before the shells are killed ? I'd even allow my shells to prevent shutdown until they saved their data if I could..
I think it is the only right solution, since the required delay varies drastically depending on how the user wants his shell to handle history.
Personnally I want it to store *many* (100.000) lines, and I had set HIST_EXPIRE_DUPS_FIRST, so that old duplicate commands are expired first.
(now I removed this option, hopefully it will make it save the history faster enough..)
I put great value in history features, and I wouldn't mind giving my zsh all the time they need to handle my history, only konsole does not know about that..

More information about the konsole-devel mailing list