Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory

Поиск
Список
Период
Сортировка
От Anders Kaseorg
Тема Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Дата
Msg-id fafa1aed-42f5-fecb-324c-06f5d5301f11@mit.edu
обсуждение исходный текст
Ответ на Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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 v1 patch also neglects the matter of documentation.  I think
> the simplest and most transparent thing to do is just to explicitly
> mention $HOME everyplace we talk about files that are sought there,
> in place of our current convention to write "~".  (I'm too lazy
> to go digging in the git history, but I have a feeling that this is
> undoing somebody's intentional change from a long time back.)

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

https://www.postgresql.org/message-id/1634252654444.90107%40mit.edu
https://www.postgresql.org/message-id/d452fd57-8c34-0a94-79c1-4498eb4ffbdc%40mit.edu

I consider my patch a bug fix that implements the behavior one would 
already expect from the existing documentation.

Therefore, I still prefer my v1 patch on both counts.  I am willing to 
be overruled if you still disagree, but I wanted to explain my reasoning.

Anders



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zhihong Yu
Дата:
Сообщение: Re: null iv parameter passed to combo_init()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory