Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6fdD-0006Hb-6b for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Jan 2022 21:21:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n6fdC-0008E3-2w for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Jan 2022 21:21:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6fdB-0008Dt-Pa for pgsql-hackers@lists.postgresql.org; Sun, 09 Jan 2022 21:21:37 +0000 Received: from outgoing-auth-1.mit.edu ([18.9.28.11] helo=outgoing.mit.edu) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6fd3-0007kM-8S for pgsql-hackers@lists.postgresql.org; Sun, 09 Jan 2022 21:21:35 +0000 Received: from [192.168.9.206] (198-27-191-186.fiber.dynamic.sonic.net [198.27.191.186]) (authenticated bits=0) (User authenticated as andersk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 209LLLdL030798 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Sun, 9 Jan 2022 16:21:22 -0500 Message-ID: Date: Sun, 9 Jan 2022 13:21:19 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory Content-Language: en-US To: Tom Lane Cc: Daniel Gustafsson , Kyotaro Horiguchi , alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org 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> <1769427.1641754742@sss.pgh.pa.us> <1796239.1641762247@sss.pgh.pa.us> From: Anders Kaseorg In-Reply-To: <1796239.1641762247@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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