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

Duration not written to history file



Good day,

When starting a fresh interactive zsh session, setting HISTFILE and
SAVEHIST and enabling the EXTENDED_HISTORY and SHARE_HISTORY options,
the duration of commands is not written to the history file:

$ setopt
interactive
monitor
shinstdin
zle
$ HISTFILE=~/history; SAVEHIST=30
$ ls
$ setopt EXTENDED_HISTORY
$ setopt SHARE_HISTORY
$ ls
history
$ cat history
: 1697804875:0;setopt
: 1697804897:0;HISTFILE=~/history; SAVEHIST=30
: 1697804902:0;ls
: 1697804914:0;setopt EXTENDED_HISTORY
: 1697804927:0;setopt SHARE_HISTORY
: 1697804928:0;ls
: 1697804930:0;cat history
$ sleep 5
$ cat history
: 1697804875:0;setopt
: 1697804897:0;HISTFILE=~/history; SAVEHIST=30
: 1697804902:0;ls
: 1697804914:0;setopt EXTENDED_HISTORY
: 1697804927:0;setopt SHARE_HISTORY
: 1697804928:0;ls
: 1697804930:0;cat history
: 1697804936:0;sleep 5
: 1697804943:0;cat history

When issuing the "fc -W" command, the duration is filled in:

$ fc -W
$ cat history
: 1697804875:0;setopt
: 1697804897:0;HISTFILE=~/history; SAVEHIST=30
: 1697804902:0;ls
: 1697804914:0;setopt EXTENDED_HISTORY
: 1697804927:0;setopt SHARE_HISTORY
: 1697804928:0;ls
: 1697804930:0;cat history
: 1697804936:5;sleep 5
: 1697804943:0;cat history
: 1697804950:0;fc -W
: 1697804952:0;cat history

Is this expected behaviour?  The equivalent of "fc -W" does not seem to
be issued by the shell at any point, not even when the session
terminates.

If this is not a bug, how should I set things up to get the duration of
commands written to the history file in a shared history setup?  Ideally
without using any hooks that runs "fc -W" after each command or similar
(that would be a hack IMHO).


Regards,
Andreas

ps. I'm currently using "zsh 5.9 (x86_64-unknown-openbsd7.4)".

-- 
Andreas (Kusalananda) Kähäri
Uppsala, Sweden

.




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