pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anders Kaseorg <andersk@mit.edu>
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, 09 Jan 2022 16:04:07 -0500
Message-ID: <1796239.1641762247@sss.pgh.pa.us> (raw)
In-Reply-To: <fafa1aed-42f5-fecb-324c-06f5d5301f11@mit.edu>
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>

Anders Kaseorg <andersk@mit.edu> writes:
> On 1/9/22 10:59, Tom Lane wrote:
>> Given the POSIX requirements, it's basically impossible to believe
>> that there are interesting cases where $HOME isn't set.  Thus, it
>> seems to me that keeping the getpwuid calls will just mean carrying
>> untestable dead code, so we should simplify matters by ripping
>> those out and *only* consulting $HOME.

> While POSIX requires that the login program put you in a conforming 
> environment, nothing stops the user from building a non-conforming 
> environment, such as with ‘env -i’.  One could argue that such a user 
> deserves whatever broken behavior they might get.  But to me it seems 
> prudent to continue working there if it worked before.

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.

>> The v1 patch also neglects the matter of documentation.

> The reason I didn’t change the documentation is that this is already 
> what “~” is supposed to mean according to POSIX and common 
> implementations.

The point here is precisely that we're changing what *we* think ~
means.  I don't think we can just leave the docs unchanged.

			regards, tom lane





view thread (18+ messages)  latest in thread

Message-ID: <1796239.1641762247@sss.pgh.pa.us>
Permalink:  ../1796239.1641762247@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1796239.1641762247@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, andersk@mit.edu, 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: <1796239.1641762247@sss.pgh.pa.us>

* 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