From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1746 invoked from network); 11 May 1997 06:39:16 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 11 May 1997 06:39:16 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id CAA17500; Sun, 11 May 1997 02:25:29 -0400 (EDT) Resent-Date: Sun, 11 May 1997 02:25:29 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199705110613.CAA05937@hzoli.home> Subject: Re: History bug still present in 3.0.3-test5 In-Reply-To: <970510221515.ZM15578@candle.brasslantern.com> from Bart Schaefer at "May 10, 97 10:15:15 pm" To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Sun, 11 May 1997 02:13:51 -0400 (EDT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"PO1j4.0.NH4.OPMTp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3117 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > I applied this patch and tried the xterm -e test above, and once again got > a truncated-to-zero history file. So whatever is going on isn't related > to this patch. And it happens with `zsh -f -l' too, so it's not some odd > thing I'm doing. > > Here's a more complete stack trace. 3.0.3-test5 with the patch from your > message applied. I only see zexit in there once, called from handler(), > so I don't think zsh has seen the EOF yet. Yes, this trace is different from the trace you sent earlier. I was now able to reproduce the bug. The bug does not happen when HISTSIZE == SAVEHIST and the history file is full (i.e. has as least SAVEHIST lines), that's why I did not see the bug before. Here is an other fix. Zoltan *** Src/hist.c 1997/05/07 08:25:04 3.1.2.3 --- Src/hist.c 1997/05/11 06:08:08 *************** *** 1484,1490 **** else out = fdopen(open(unmeta(s), O_CREAT | O_WRONLY | O_TRUNC, 0600), "w"); if (out) { ! for (; ev <= curhist; ev++) { ent = gethistent(ev); if (app & 2) { if (ent->flags & HIST_OLD) --- 1484,1490 ---- else out = fdopen(open(unmeta(s), O_CREAT | O_WRONLY | O_TRUNC, 0600), "w"); if (out) { ! for (; ev <= curhist - !!histactive; ev++) { ent = gethistent(ev); if (app & 2) { if (ent->flags & HIST_OLD)