Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory - Mailing list pgsql-hackers

From Anders Kaseorg
Subject Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Date
Msg-id d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu
Whole thread Raw
In response to Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Next
From: Justin Pryzby
Date:
Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory