zsh-users
 help / color / mirror / code / Atom feed
From: "Andreas Kähäri" <andreas.kahari@abc.se>
To: zsh-users@zsh.org
Subject: Duration not written to history file
Date: Fri, 20 Oct 2023 14:42:56 +0200	[thread overview]
Message-ID: <ZTJ10FQ58vjQhJo3@harpo.local> (raw)

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

.


             reply	other threads:[~2023-10-20 12:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 12:42 Andreas Kähäri [this message]
2023-10-20 19:49 ` Bart Schaefer
2023-10-20 21:39   ` Andreas Kähäri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTJ10FQ58vjQhJo3@harpo.local \
    --to=andreas.kahari@abc.se \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).