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

From: Anders Kaseorg <andersk(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, alvherre(at)alvh(dot)no-ip(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Date: 2022-01-09 21:21:19
Message-ID: d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/9/22 13:04, Tom Lane wrote:
> The only case that the v1 patch helps such a user for is if they
> unset HOME or set it precisely to ''. If they set it to anything
> else, it's still broken from their perspective. So I do not find
> that that argument holds water.
>
> Moreover, ISTM that the only plausible use-case for unsetting HOME
> is to prevent programs from finding stuff in your home directory.
> What would be the point otherwise? So it's pretty hard to envision
> a case where somebody is actually using, and happy with, the
> behavior you argue we ought to keep.

Obviously a user who intentionally breaks their environment should
expect problems. But what I’m saying is that a user could have written
a script that unsets HOME by *accident* while intending to clear *other*
things out of the environment. They might have developed it by starting
with an empty environment and adding back the minimal set of variables
they needed to get something to work. Since most programs (including
most libcs and shells) do in fact fall back to getpwuid when HOME is
unset, they may not have noticed an unset HOME as a problem. Unsetting
HOME does not, in practice, prevent most programs from finding stuff in
your home directory.

Anders

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-01-09 21:26:28 Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Previous Message Tom Lane 2022-01-09 21:04:07 Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory