From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Anders Kaseorg <andersk(at)mit(dot)edu> |
Cc: | Daniel Gustafsson <daniel(at)yesql(dot)se>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, alvherre(at)alvh(dot)no-ip(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory |
Date: | 2022-01-09 21:04:07 |
Message-ID: | 1796239.1641762247@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Anders Kaseorg <andersk(at)mit(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Anders Kaseorg | 2022-01-09 21:21:19 | Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory |
Previous Message | Anders Kaseorg | 2022-01-09 20:50:54 | Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory |