Tom Lane wrote:

> If we take this patch, what's to stop someone from complaining that we
> broke *their* badly-designed system that abuses the HOME variable?

POSIX warns against doing that, listing HOME in the variables that
should be left to their intended usage:

  If the variables in the following two sections are present in the
  environment during the execution of an application or utility, they
  shall be given the meaning described below
  The system shall initialize this variable at the time of login to
  be a pathname of the user's home directory. See <pwd.h>.

psql is indirectly using $HOME already for readline and terminfo:

$ HOME=/tmp/home2 strace psql 2>tr ; grep home2 tr
stat("/tmp/home2/.terminfo", 0x7ff985bf4730) = -1 ENOENT (No such file or
stat("/tmp/home2/.inputrc", 0x7fff3f641d70) = -1 ENOENT (No such file or

Also when using Debian's psql, the wrapper looks for it own config file in
open("/tmp/home2/.postgresqlrc", O_RDONLY) = -1 ENOENT (No such file or
Being written in Perl, it could use getpwuid(), but it doesn't, like I
the majority of programs that just want the home directory.

+1 on using HOME for being consistent with other pieces of code around
postgres, and for the easiness of locally overriding it when
troubleshooting problems with dot files.

Best regards,
Daniel Vérité
PostgreSQL-powered mailer:
Twitter: @DanielVerite

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to