Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christoph Moench-Tegeder <cmt@burggraben.net>
Cc: Anders Kaseorg <andersk@mit.edu>, Daniel Gustafsson <daniel@yesql.se>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>, alvherre@alvh.no-ip.org,
pgsql-hackers@lists.postgresql.org
Date: 2022-01-09T22:40:08Z
Lists: pgsql-hackers
Christoph Moench-Tegeder <cmt@burggraben.net> writes:
> ## Tom Lane (tgl@sss.pgh.pa.us):
>> Given the POSIX requirements, it's basically impossible to believe
>> that there are interesting cases where $HOME isn't set.
> When I look at a random Debian with the usual PGDG packages, the
> postmaster process (and every backend) has a rather minimal environment
> without HOME. When I remember the code correctly, walreceiver uses
> the functions from fe-connect.c and may need to find the service file,
> a password file or certificates. If I'm correct with that, requiring
> HOME to be set would be a significant change for existing "normal"
> installations.
> What about containers and similar "reduced" environments?
Isn't that a flat out violation of POSIX 8.3 Other Environment Variables?
HOME
The system shall initialize this variable at the time of login to
be a pathname of the user's home directory. See <pwd.h>.
To claim it's not, you have to claim these programs aren't logged in,
in which case where did they get any privileges from?
regards, tom lane
Commits
-
Clean up messy API for src/port/thread.c.
- 98e93a1fc93e 15.0 landed
-
Prefer $HOME when looking up the current user's home directory.
- 376ce3e404b7 15.0 landed