Re: bogus psql "could not save history file[...]" message in 9.3.6

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Frost <jeff(at)pgexperts(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: bogus psql "could not save history file[...]" message in 9.3.6
Date: 2015-03-14 02:22:28
Message-ID: 31999.1426299748@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jeff Frost <jeff(at)pgexperts(dot)com> writes:
>> On Mar 13, 2015, at 9:56 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> strace'ing psql while it exits might be informative.

> Here you go:

> ...
> rename("/var/lib/postgresql/.psql_history", "/var/lib/postgresql/.psql_history-") = -1 ENOENT (No such file or directory)
> open("/var/lib/postgresql/.psql_history", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
> write(3, "select 1;\n", 10) = 10
> close(3) = 0
> unlink("/var/lib/postgresql/.psql_history-") = -1 ENOENT (No such file or directory)

... WTF? That rename() and that unlink() are certainly not coming from
Postgres, and I do not see anything like that in the libedit sources
either. (I'm looking at the libedit-20141030-3.1 version that Fedora
is currently shipping.) That must be coming from some Ubuntu-specific
patch?

> open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

I'm guessing here, but I suspect these calls are coming from strerror()
looking for a translated version of "No such file or directory" --- ie,
at this point the damage is already done and we are trying to report
that we think we've failed.

Short answer seems to be that Ubuntu stuck in a patch that thinks nothing
of clobbering errno during a write_history() call.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2015-03-14 02:46:19 Re: bogus psql "could not save history file[...]" message in 9.3.6
Previous Message Jeff Frost 2015-03-14 02:02:17 Re: bogus psql "could not save history file[...]" message in 9.3.6