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

Re: [4.0.2 bug] commands not written to history



On 12 Jul, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> Was there more than one zsh process involved?

Yes, on the same machine of course.

> This difference could be explained by HIST_IGNORE_DUPS (which you said
> in 3981 that you do have set) if you ran the command "mail" twice in
> a row.

I have the following:

  setopt INC_APPEND_HISTORY NO_SHARE_HISTORY
  setopt EXTENDED_HISTORY
  setopt HIST_IGNORE_DUPS NO_HIST_IGNORE_ALL_DUPS
  setopt NO_HIST_ALLOW_CLOBBER HIST_REDUCE_BLANKS
  setopt HIST_IGNORE_SPACE HIST_NO_STORE HIST_NO_FUNCTIONS
  setopt HIST_BEEP

and

HISTSIZE=2000
SAVEHIST=2000
HISTFILE="$HOME2/.zhistory"

($HOME2 is my home on the local hard disk when there is one, otherwise
it has the same value as $HOME.)

>  The in-memory history gets the most recent start-time, but the
> file is not re-written unless the command text differs.  I suppose that
> could be considered a bug when EXTENDED_HISTORY is set, but there's no
> good fix except to save a duplicate in the file even though there is
> no duplicate in memory.  And I hadn't realized that INC_APPEND_HISTORY
> causes the elapsed-time to be lost from the entries, but that makes
> sense because they're written out before the command has finished.

Is there a reason? Why shouldn't they be written out after the command
finishes?

> } 116,120c116,119
> } < : 994939941:0;m $HISTFILE
> } < : 994939999:0;mail
> } < : 994940004:0;m $HISTFILE
> } < : 994940081:0;mail
> } < : 994940743:0;rem
> } ---
> } > : 994939966:13;m $HISTFILE
> } > : 994939999:2;mail
> } > : 994940004:8;m $HISTFILE
> } > : 994940743:308;rem

> There are more commands in $HISTFILE than in temphistfile, which means
> that the command was written to $HISTFILE but is not present in memory.
> That's extremely odd unless $HISTFILE was written by two or more shells
> (each using INC_APPEND_HISTORY) or unless you have one of the IGNORE_ALL
> options set (which you've previously said that you don't).  Hence my very
> first question.

Yes, there were 2 shells (using the same options). I think this is
the same one that executed the mail command, and the other one that
executed the "m $HISTFILE" command. BTW, how about writing a shell
identifier (perhaps the tty?) to the extended history?

> I'm curious about lines 113-115.  They have zero elapsed times in both
> $HISTFILE and temphisfile (otherwise they'd have showed up as a diff).
> So either those were very short commands (executed in less than 1 sec.)

Yes, this is the case (2 echo and 1 wc).

> It's a little bit odd that the start times for the first "m $HISTORY"
> commands are different as recorded in $HISTFILE and temphistfile.  Could
> be another ignore-dups thing.

Perhaps.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



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