From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prefer $HOME when looking up the current user's home directory.
Date: Mon, 10 Jan 2022 00:19:28 +0000
Message-ID: <E1n6iPI-0005HG-MS@gemulon.postgresql.org> (raw)
Prefer $HOME when looking up the current user's home directory.
When we need to identify the home directory on non-Windows, first
consult getenv("HOME"). If that's empty or unset, fall back
on our previous method of checking the <pwd.h> database.
Preferring $HOME allows the user to intentionally point at some
other directory, and it seems to be in line with the behavior of
most other utilities. However, we shouldn't rely on it completely,
as $HOME is likely to be unset when running as a daemon.
Anders Kaseorg
Discussion: https://postgr.es/m/1634252654444.90107@mit.edu
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/376ce3e404b75d267089c4bc6dc7c18d0b38728b
Modified Files
--------------
src/bin/psql/command.c | 31 +++++++++++++++++++------------
src/interfaces/libpq/fe-connect.c | 21 ++++++++++++++-------
src/port/path.c | 25 ++++++++++++++++++-------
3 files changed, 51 insertions(+), 26 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Prefer $HOME when looking up the current user's home directory.
In-Reply-To: <E1n6iPI-0005HG-MS@gemulon.postgresql.org>
References: <E1n6iPI-0005HG-MS@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox