bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

history bug: new shell separates lines from the history file


From: Michael Tosch
Subject: history bug: new shell separates lines from the history file
Date: Thu, 21 Nov 2024 15:59:46 +0100

Hello, I want to file a bug in bash.

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto
-ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security
-Wall
uname output: Linux micha-VirtualBox 5.15.0-126-generic #136-Ubuntu SMP Wed
Nov 6 10:38:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:

In bash I do

bash-5.1$
bash-5.1$ shopt| grep hist
cmdhist         on
histappend     off
histreedit     off
histverify     off
lithist         on
bash-5.1$ echo $HISTTIMEFORMAT
%F %T
bash-5.1$ for i in a b c
> do
>   echo $i
> done
a
b
c
bash-5.1$ history 5
  503  2024-11-21 13:44:22 ls
  504  2024-11-21 13:44:31 shopt| grep hist
  505  2024-11-21 13:45:11 echo $HISTTIMEFORMAT
  506  2024-11-21 13:45:26 for i in a b c
do
  echo $i
done
  507  2024-11-21 13:45:51 history 5
bash-5.1$ exit


In a new shell I get

bash-5.1$ history 10
  491  2024-11-21 13:44:22 ls
  492  2024-11-21 13:44:31 shopt| grep hist
  493  2024-11-21 13:45:11 echo $HISTTIMEFORMAT
  494  2024-11-21 13:45:26 for i in a b c
  495  2024-11-21 13:48:30 do
  496  2024-11-21 13:48:30   echo $i
  497  2024-11-21 13:48:30 done
  498  2024-11-21 13:45:51 history 5
  499  2024-11-21 13:48:27 exit
  500  2024-11-21 13:48:46 history 10
bash-5.1$


The previously embedded lines (the for loop) now have got a timestamp (the
one from the shell start?)!
This is unwanted behavior, because now a cursor-up brings the separated
lines.
The history file still correctly shows the embedded lines:

bash-5.1$ tail .bash_history
echo $HISTTIMEFORMAT
#1732192406
for i in a b c
do
  echo $i
done
#1732192443
history 5
#1732192600
exit


reply via email to

[Prev in Thread] Current Thread [Next in Thread]