Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YWbin-0006oF-Is for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Mar 2015 02:22:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YWbim-0001Y4-Ig for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Mar 2015 02:22:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YWbil-0001Xx-LM for pgsql-bugs@postgresql.org; Sat, 14 Mar 2015 02:22:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YWbii-0001C7-2V for pgsql-bugs@postgresql.org; Sat, 14 Mar 2015 02:22:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t2E2MS0Y032000; Fri, 13 Mar 2015 22:22:28 -0400 From: Tom Lane To: Jeff Frost cc: "David G. Johnston" , "pgsql-bugs@postgresql.org" Subject: Re: bogus psql "could not save history file[...]" message in 9.3.6 In-reply-to: References: <31313.1426298202@sss.pgh.pa.us> Comments: In-reply-to Jeff Frost message dated "Fri, 13 Mar 2015 22:02:17 -0400" Date: Fri, 13 Mar 2015 22:22:28 -0400 Message-ID: <31999.1426299748@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Jeff Frost writes: >> On Mar 13, 2015, at 9:56 PM, Tom Lane 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs