Re: libedit history seems to be misbehaving / broken - Mailing list pgsql-hackers

From Rudolph Froger
Subject Re: libedit history seems to be misbehaving / broken
Date
Msg-id CALaJbqz262ax=t8W32oujxM+5Kn7Ov5nT+rZgaJn70CbRroFfQ@mail.gmail.com
Whole thread Raw
In response to Re: libedit history seems to be misbehaving / broken  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers

On Wed, 22 Jan 2025 at 08:54, Bruce Momjian <bruce@momjian.us> wrote:
On Sun, Oct 27, 2024 at 09:07:44PM +0100, Tomas Vondra wrote:
> On 10/27/24 20:03, Tom Lane wrote:
> > FWIW, I don't observe any particular misbehavior with the very ancient
> > libedit that macOS ships.  On Fedora 39, I notice something related to
> > what you say: it seems like the "\q" ending a session gets repeated
> > into .psql_history by the next session.  I'm surprised that it's not
> > exactly the same as your results though, because it seems to be the
> > same source version:
> >
> > $ rpm -q libedit
> > libedit-3.1-53.20240808cvs.fc39.x86_64
> >
>
> That's probably because I usually terminate psql by Ctrl-D, not by
> typing "\q". But yeah, if I use "\q" it gets added twice.
>
> > Didn't try the too-many-lines behavior, but it looks like that
> > is implemented totally by history_truncate_file(), so if that's
> > busted it's surely their fault.
> >
>
> Sounds likely. What surprises me a bit, I haven't found any reports of
> particularly similar bugs ... I'd have expected other people to hit this
> too, but who knows.

I wonder if our previous libedit workarounds aren't needed anymore and
are causing the bugs.

I'm experiencing a similar behaviour. Indeed adding _HiStOrY_V2_ to the top of the .psql_history file fixes the issue, until libedit (?) strips it off again.

---

Rudolph Froger

pgsql-hackers by date:

Previous
From: Japin Li
Date:
Subject: Re: [RFC] Lock-free XLog Reservation from WAL
Next
From: Yura Sokolov
Date:
Subject: Re: [RFC] Lock-free XLog Reservation from WAL