Issues with building snap packages and psql

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Issues with building snap packages and psql
Date: 2016-10-26 17:09:11
Message-ID: 2db4f9df-fc9e-14a3-9fc8-5318283f0937@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

CMD has been working on building snap packages. It has been an adventure
and we are very close to having them complete. In fact they are complete
enough that we have published them in the snap repo.

jd(at)jd-wks:~$ snap find postgres
Name Version Developer Notes Summary
postgresql96 9.6.0 cmd - PostgreSQL is a powerful,
open source object-relational database system.
postgresql95 9.5.3 cmd - PostgreSQL is a powerful,
open source object-relational database system.
postgresql94 9.4.9 cmd - PostgreSQL is a powerful,
open source object-relational database system.
postgresql93 9.3.14 cmd - PostgreSQL is a powerful,
open source object-relational database system.

However, we have found a problem with permissions that we haven't been
able to overcome. The error presents as a simple:

could not save history to file "/home/jd/.psql_history": Permission denied

We tried the work around as presented here:

https://www.commandprompt.com/blog/psql_tip_change_history_location/

It didn't work and I couldn't figure out why. It was especially
confusing because if you are in psql via snap $HOME is set correctly:

postgres=# \! export
export HOME='/home/jd/snap/postgresql96/1'

Then I traced it and saw this:

open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 7
lseek(7, 0, SEEK_CUR) = 0
fstat(7, {st_mode=S_IFREG|0644, st_size=2581, ...}) = 0
mmap(NULL, 2581, PROT_READ, MAP_SHARED, 7, 0) = 0x7f1f9e5fc000
lseek(7, 2581, SEEK_SET) = 2581
munmap(0x7f1f9e5fc000, 2581) = 0
close(7) = 0
[...]
futex(0x1096088, FUTEX_WAIT, 0, NULL) = 0
futex(0x1096088, FUTEX_WAIT, 0, NULL/home/jd/.psqlrc: Permission denied
psql (9.6.0)
Type "help" for help.

postgres=# \q
could not save history to file "/home/jd/.psql_history": Permission denied
<unfinished ...>
+++ exited with 0 +++

Is psql getting the home directory from /etc/passwd? If so what can we
do about that?

Sincerely,

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
Unless otherwise stated, opinions are my own.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-10-26 17:16:16 Re: Issues with building snap packages and psql
Previous Message Robert Haas 2016-10-26 17:02:27 Re: Improving RLS planning