From: Rick Otten <rotten@windfish.net>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #14287: psql_history gets wiped out
Date: Fri, 12 Aug 2016 12:32:16 -0400
Message-ID: <59009b1730d8b42e4d08226c3fe08058@www.windfish.net> (raw)
In-Reply-To: <d3ce9b1d-b5a8-4598-aafa-3f3e1b2a7f22@mm>
References: <d3ce9b1d-b5a8-4598-aafa-3f3e1b2a7f22@mm>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Aha. Indeed my path was going straight to the psql binary without
passing through the /usr/bin/psql perl wrapper.
Even when I use the wrapper, I was still able to reproduce wiping out my
.psql_history file by closing the window before exiting psql.
On 2016-08-12 12:21, Daniel Verite wrote:
> Rick Otten wrote:
>
>> think I have readline installed on the system: $ dpkg -l | grep readline ii libreadline5:amd64 5.2+dfsg-2 amd64 GNU readline and history libraries, run-time libraries ii libreadline6:amd64 6.3-4ubuntu2 amd64 GNU readline and history libraries, run-time libraries ii readline-common
>
> According to the strace output, the replacement of libedit
> by libreadline at runtime does not happen in your case
> (the "_HiStOrY_V2_" string is from libedit).
>
> This replacement is done by pg_wrapper, a Perl script to which
> /usr/bin/psql is normally linked:
> $ ls -l /usr/bin/psql
> /usr/bin/psql -> ../share/postgresql-common/pg_wrapper
> The script pushes libreadline over libedit through LD_PRELOAD, and
> launches the actual binary located in
> /usr/lib/postgresql/X.Y/bin/psql (where X.Y is the current cluster's
> PG version).
>
> You may want to check if that script is not entirely sidestepped in
> your setup, as that would explain why libedit gets used. For instance,
> a modified PATH or psql being a shell alias could lead to that.
>
> Aside from the bug resulting in an empty file, libedit
> will ignore readline's history and remove it from the file
> when saving, which is annoying by itself if using it by accident.
>
> Best regards,
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: rotten@windfish.net
Subject: Re: BUG #14287: psql_history gets wiped out
In-Reply-To: <59009b1730d8b42e4d08226c3fe08058@www.windfish.net>
References: <d3ce9b1d-b5a8-4598-aafa-3f3e1b2a7f22@mm> <59009b1730d8b42e4d08226c3fe08058@www.windfish.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox