pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anders Kaseorg <andersk@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: alvherre@alvh.no-ip.org
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Date: Sun, 9 Jan 2022 13:21:19 -0800
Message-ID: <d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu> (raw)
In-Reply-To: <1796239.1641762247@sss.pgh.pa.us>
References: <202110182223.zeze33l55qa5@alvherre.pgsql>
	<20211019.173422.706584612464055211.horikyota.ntt@gmail.com>
	<5d675cbe-7837-e9ae-961d-be7d03201f3b@mit.edu>
	<20211020.144014.580443822870543857.horikyota.ntt@gmail.com>
	<07CA67A0-A46C-4ED5-99C6-24D41BDDC8CA@yesql.se>
	<d452fd57-8c34-0a94-79c1-4498eb4ffbdc@mit.edu>
	<1769427.1641754742@sss.pgh.pa.us>
	<fafa1aed-42f5-fecb-324c-06f5d5301f11@mit.edu>
	<1796239.1641762247@sss.pgh.pa.us>

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





view thread (18+ messages)  latest in thread

Message-ID: <d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu>
Permalink:  ../d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu/
Also on:    postgresql.org/message-id/d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andersk@mit.edu, tgl@sss.pgh.pa.us, daniel@yesql.se, horikyota.ntt@gmail.com, alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
  In-Reply-To: <d75e02b2-59a8-17d8-9eb2-c22e5ced7ebd@mit.edu>

* 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