From: any
To: bug-bash@gnu.org
Subject: Unexpected results using history builtin with -ps options
	

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 
uname output: Linux fedora-kde 6.15.9-201.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Aug  2 11:37:34 UTC 2025 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 5.2
Patch Level: 37
Release Status: release

Description:
	Using history builtin with -ps options give unexpected results
	For example after executing:
	dnf -q repoquery --list bash-doc | fold -w $(($COLUMNS/3-1)) | pr -3tw $COLUMNS
	if we enter:
	history -p !!
	history 10
	we got:
	1338  dnf -q repoquery --list bash-doc | fold -w $(($COLUMNS/3-1)) | pr -3tw $COLUMNS
	1339  history -p dnf -q repoquery --list bash-doc | fold -w $(($COLUMNS/3-1)) | pr -3tw $COLUMNS
	1340  history 10
	As you see the 'history -p ...' command got in history though it doesn't
	This only occur this command 'dnf -q repoquery ...'

Repeat-By:
	[Describe the sequence of events that causes the problem
	to occur.]

Fix:
	[Description of how to fix the problem.  If you don't know a
	fix for the problem, don't include this section.]
