pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16956: psql won't load command history
3+ messages / 3 participants
[nested] [flat]

* BUG #16956: psql won't load command history
@ 2021-04-08 15:00 PG Bug reporting form <noreply@postgresql.org>
  2021-04-08 16:04 ` Re: BUG #16956: psql won't load command history Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2021-04-08 15:00 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: robin.knipe@gmail.com

The following bug has been logged on the website:

Bug reference:      16956
Logged by:          Robin Knipe
Email address:      robin.knipe@gmail.com
PostgreSQL version: 12.6
Operating system:   kubuntu-18.04.2, docker postgres:12-alpine
Description:        

Running the `psql` command from docker (postgres:12-alpine), fails to load
the `.psql_history` command contents. Strangely, the session's commands ARE
SAVED though! Also I can read the history contents in the psql session, as
the following raw output shows:
```
levqa=> \echo `echo $PSQL_HISTORY`
/.psql_history
levqa=> \echo `tail $PSQL_HISTORY`
_HiStOrY_V2_
_HiStOrY_V2_
_HiStOrY_V2_
_HiStOrY_V2_
echo\040HISTCONTROL\012;
`echo\040HISTCONTROL`\012;
\134echo\040:HISTCONTROL
\134echo\040:HISTFILE
\134set\040HISTFILE\040/.psql_history
\134echo\040:HISTFILE
levqa=>
```

FYI: the docker command I'm running:
```
docker run \
  -it \
  --entrypoint=bash \
  --network=host \
  --mount type=bind,source="$( ls ~/.psql_history )",target="/.psql_history"
\
  -e PGPASSWORD="${PASS}" \
  -e PSQL_HISTORY="/.psql_history" \
  postgres:12-alpine \
    -wh localhost \
    "${NAME}" \
    "${USER}"
```



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #16956: psql won't load command history
  2021-04-08 15:00 BUG #16956: psql won't load command history PG Bug reporting form <noreply@postgresql.org>
@ 2021-04-08 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>
  2021-04-08 17:14   ` Re: BUG #16956: psql won't load command history Robin Knipe <robin.knipe@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2021-04-08 16:04 UTC (permalink / raw)
  To: robin.knipe@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> Running the `psql` command from docker (postgres:12-alpine), fails to load
> the `.psql_history` command contents. Strangely, the session's commands ARE
> SAVED though! Also I can read the history contents in the psql session, as
> the following raw output shows:
> ```
> levqa=> \echo `echo $PSQL_HISTORY`
> /.psql_history
> levqa=> \echo `tail $PSQL_HISTORY`
> _HiStOrY_V2_
> _HiStOrY_V2_
> _HiStOrY_V2_
> _HiStOrY_V2_
> echo\040HISTCONTROL\012;
> `echo\040HISTCONTROL`\012;
> \134echo\040:HISTCONTROL
> \134echo\040:HISTFILE
> \134set\040HISTFILE\040/.psql_history
> \134echo\040:HISTFILE
> levqa=>
> ```

No concrete ideas to offer, but I'm pretty sure that that history-file
format is only supposed to have one "_HiStOrY_V2_" marker line at the
start.  Maybe getting rid of the extras would de-confuse it.

Anyway, none of Postgres' own code touches that file.  If there's a
bug here, it's in libedit.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #16956: psql won't load command history
  2021-04-08 15:00 BUG #16956: psql won't load command history PG Bug reporting form <noreply@postgresql.org>
  2021-04-08 16:04 ` Re: BUG #16956: psql won't load command history Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-04-08 17:14   ` Robin Knipe <robin.knipe@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Robin Knipe @ 2021-04-08 17:14 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

Hi Tom

Thanks for your reply. I think those _HiStOrY_V2_ entries are just the
start of the saved session, so the multiples there signify empty sessions,
where I've started a session, checked for history (by pressing up arrow)
and then exited again without entering any commands. I'll see if I can
report the bug to `libedit`...

Thanks,

Robin.


On Thu, 8 Apr 2021 at 17:04, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> PG Bug reporting form <noreply@postgresql.org> writes:
> > Running the `psql` command from docker (postgres:12-alpine), fails to
> load
> > the `.psql_history` command contents. Strangely, the session's commands
> ARE
> > SAVED though! Also I can read the history contents in the psql session,
> as
> > the following raw output shows:
> > ```
> > levqa=> \echo `echo $PSQL_HISTORY`
> > /.psql_history
> > levqa=> \echo `tail $PSQL_HISTORY`
> > _HiStOrY_V2_
> > _HiStOrY_V2_
> > _HiStOrY_V2_
> > _HiStOrY_V2_
> > echo\040HISTCONTROL\012;
> > `echo\040HISTCONTROL`\012;
> > \134echo\040:HISTCONTROL
> > \134echo\040:HISTFILE
> > \134set\040HISTFILE\040/.psql_history
> > \134echo\040:HISTFILE
> > levqa=>
> > ```
>
> No concrete ideas to offer, but I'm pretty sure that that history-file
> format is only supposed to have one "_HiStOrY_V2_" marker line at the
> start.  Maybe getting rid of the extras would de-confuse it.
>
> Anyway, none of Postgres' own code touches that file.  If there's a
> bug here, it's in libedit.
>
>                         regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2021-04-08 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 15:00 BUG #16956: psql won't load command history PG Bug reporting form <noreply@postgresql.org>
2021-04-08 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-04-08 17:14   ` Robin Knipe <robin.knipe@gmail.com>

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