From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27944 invoked from network); 4 Jul 2004 11:08:55 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 4 Jul 2004 11:08:55 -0000 Received: (qmail 28558 invoked from network); 4 Jul 2004 12:21:49 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Jul 2004 12:21:49 -0000 Received: (qmail 29630 invoked by alias); 4 Jul 2004 11:07:14 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7663 Received: (qmail 25572 invoked from network); 4 Jul 2004 10:40:34 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 4 Jul 2004 10:40:34 -0000 Received: (qmail 18244 invoked from network); 4 Jul 2004 11:54:26 -0000 Received: from zamok.crans.org (138.231.136.6) by a.mx.sunsite.dk with SMTP; 4 Jul 2004 11:54:13 -0000 Received: from localhost (localhost.crans.org [127.0.0.1]) by zamok.crans.org (Postfix) with ESMTP id 0F32A1C0315D for ; Sun, 4 Jul 2004 12:40:20 +0200 (CEST) Received: from zamok.crans.org ([127.0.0.1]) by localhost (zamok [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29382-04 for ; Sun, 4 Jul 2004 12:40:19 +0200 (CEST) Received: from charonne.dyndns.org (m50.net81-65-198.noos.fr [81.65.198.50]) by zamok.crans.org (Postfix) with ESMTP id AA3781C0315C for ; Sun, 4 Jul 2004 12:40:18 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by charonne.dyndns.org (Postfix) with ESMTP id 5702047C094 for ; Sun, 4 Jul 2004 12:40:11 +0200 (CEST) Subject: histroy file being truncated (konsole with multiple shells context) From: Samuel Krempp To: zsh-users@sunsite.dk Content-Type: text/plain Message-Id: <1088937610.4949.41.camel@marvin.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 04 Jul 2004 12:40:10 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at crans.org X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: ** X-Spam-Status: No, hits=2.1 required=6.0 tests=RCVD_IN_RFCI,RCVD_IN_SORBS, RISK_FREE autolearn=no version=2.63 X-Spam-Hits: 2.1 I noticed some people already noticed that kind of unreproduced behaviour ("vanishing history", http://www.zsh.org/mla/users/2002/msg00105.html ) It's becoming very frequent for me, with 3 or 4 zsh shells inside a konsole (kde's advanced console for those that are not familiar with kde), and zsh history set with HISTSIZE=99000 SAVEHIST=90000 I get truncated $HISTFILE files from time to time, and then there are several $HISTFILE. empty files created (with the numbers certainly being the PIDs of the shells whose history was being written, I guess) konsole gives the shell 1s to shut down before killing it. So I guess zsh starts writing a new history file when shutting down, and if it is stopped before the end, the file ends-up truncated. Shouldn't zsh be cautious about that, and use some safe commit idiom ? (i.e. write the new file $HISTFILE.new, then commit the swap of it with the old $HISTFILE in an atomic way) BTW, how does incappendhistory works ? is the history written at each and every command, even if it means rewriting it completely every time ? I'm using zsh a lot, and I'd really like to be able to rely on its history for automatically archiving complicated commands and parameter sets, with no risk of loosing any command. In the case of very big $HISTFILE, it seems to me the best solution to insure all commands end-up in the $HISTFILE even in case of brutal shutdown is for each zsh to write incremental temporary histfiles (by plain appending), then merging them (with a safe commit method) into the final $HISTFILE at regular intervals. zsh can then check for these files at startup, and do the merging of any temporary files pending from last session. A scheme like that should be both efficient and reliable, right ? -- Sam