zsh-workers
 help / color / mirror / code / Atom feed
From: Leah Neukirchen <leah@vuxu.org>
To: zsh-workers@zsh.org
Subject: [BUG] Trailing backslash in history file confuses entries
Date: Tue, 09 Nov 2021 23:46:43 +0100	[thread overview]
Message-ID: <87v911ymjw.fsf@vuxu.org> (raw)

Hi,

I noticed this weird behavior:

% zsh --version
zsh 5.8 (x86_64-unknown-linux-gnu)
% zsh -f
rhea% SAVEHIST=9000 HISTSIZE=9000 HISTFILE=/tmp/.zsh_history 
rhea% setopt INC_APPEND_HISTORY EXTENDED_HISTORY
rhea% less foo\<RET><C-c>   # this saves a line with final \ to .zsh_history
rhea% echo bar
bar
rhea% <C-c>
% zsh -f
rhea% SAVEHIST=9000 HISTSIZE=9000 HISTFILE=/tmp/.zsh_history
rhea% fc -R   # load history, same happens without zsh -f by default...
rhea% <UP>
rhea% less foo
: 1636497381:0;echo bar
<C-c>
% tail -n2 /tmp/.zsh_history 
: 1636497373:0;less foo\
: 1636497381:0;echo bar

As you can see, zsh parses the trailing backslash as a line
continuation and assumes the two lines were entered at once
(EXTENDED_HISTORY increases the confusion of the user here).
I assume some kind of escaping has been forgotten in this case.

Thanks,
-- 
Leah Neukirchen  <leah@vuxu.org>  https://leahneukirchen.org/


             reply	other threads:[~2021-11-09 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 22:46 Leah Neukirchen [this message]
2021-11-24 23:04 ` Oliver Kiddle

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=87v911ymjw.fsf@vuxu.org \
    --to=leah@vuxu.org \
    --cc=zsh-workers@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).