Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Anders Kaseorg <andersk@mit.edu>
From: Anders Kaseorg <andersk@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: 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:21:19Z
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
Commits
-
Clean up messy API for src/port/thread.c.
- 98e93a1fc93e 15.0 landed
-
Prefer $HOME when looking up the current user's home directory.
- 376ce3e404b7 15.0 landed