Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: History bug still present in 3.0.3-test5



> 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)



Messages sorted by: Reverse Date, Date, Thread, Author