Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory

Christoph Moench-Tegeder <cmt@burggraben.net>

From: Christoph Moench-Tegeder <cmt@burggraben.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
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-09T21:51:37Z
Lists: pgsql-hackers
## 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?

Regards,
Christoph

-- 
Spare Space



Commits

  1. Clean up messy API for src/port/thread.c.

  2. Prefer $HOME when looking up the current user's home directory.