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