From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19210 invoked from network); 21 Jul 2001 18:33:20 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Jul 2001 18:33:20 -0000 Received: (qmail 10493 invoked by alias); 21 Jul 2001 18:33:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15440 Received: (qmail 10477 invoked from network); 21 Jul 2001 18:33:11 -0000 From: "Bart Schaefer" Message-Id: <1010721183220.ZM8456@candle.brasslantern.com> Date: Sat, 21 Jul 2001 18:32:20 +0000 In-Reply-To: <20010721154449.A1971@ay.free.fr> Comments: In reply to Vincent Lefevre "Re: [4.0.2 bug] commands not written to history" (Jul 21, 3:44pm) References: <20010629163348.A9632@greux.loria.fr> <20010721154449.A1971@ay.free.fr> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk, Vincent Lefevre Subject: Re: [4.0.2 bug] commands not written to history MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii [Moved to zsh-workers] On Jul 21, 3:44pm, Vincent Lefevre wrote: } Subject: Re: [4.0.2 bug] commands not written to history } } This problem occurred again, but this time with a local FS [...] } Moreover, the command I got after cmd1 was "startx", which means that } cmd2 (the command that hadn't been written to the history) was the } last command typed in the shell, like in my previous bug report. Something that just occurred to me: You're sure that `cmd2' has run to completion and the prompt has returned before the shell where you typed that command exited? E.g. you didn't type `cmd2' and then while it was still running, shut down your X server or kill the xterm window? Here's what you should try next: Make a directory ~/zhist-debug (call it whatever you like). Put in your .zshrc the commands: date > ~/zhist-debug/startup.$$ TRAPEXIT() { # Order here is important! fc -WI ~/zhist-debug/unsaved.$$ fc -W ~/zhist-debug/complete.$$ # This assumes you have GNU `cp' cp -p $HISTFILE ~/zhist-debug/histfile.$$ } If there is a `startup' file with none of the other files, then zsh may be exiting without writing the history at all, which shouldn't matter with INC_APPEND_HISTORY but might be a clue all the same. Because zsh writes the history before calling TRAPEXIT, the `unsaved' file should always be empty. If it is not, then INC_APPEND_HISTORY is causing an error when the history is written at exit time. For the same reason, the modify time of the `histfile' file (copied from $HISTFILE by `cp -p') should be EARLIER THAN the modify time of the `complete' file. If it isn't, then multiple shells are writing to the histfile almost simultaneously (e.g., because you killed your entire X session rather than exiting from each individual shell), so zsh may have a locking problem. (Note that if you exit from a lot of shells at once, even if locking is working properly the order in which $HISTFILE gets updated will be essentially random; obtaining the lock is a race.) My guess is that `startx' is being inserted into $HISTFILE by your console login shell at the time the `startx' command finishes, i.e., after all the xterm shells have shut down. So none of the `histfile' files except the one for the console shell should have the `startx' command at the end. If `startx' appears near the end of more than one of those files, then the problem may be that the console shell is incrementally appending `startx' to $HISTFILE before all the exiting xterm shells have finished saving their own commands, thus garbling the expected ordering. If none of these races happened, then the `complete' file should have the same last $HISTSIZE entries (assuming SAVEHIST > HISTSIZE) as the `histfile' file, possibly modulo incrementally saved entries from other shells which may have been in $HISTFILE. Any unexplained differences may give us a clue. Finally, by examining the file times of the various files we can tell in what order the shells are starting and exiting, which may help determine what sequence of events causes the error. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net