Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rmDts-006j2D-3g for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Mar 2024 14:23:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rmDtq-002YSR-KO for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Mar 2024 14:23:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rmDtq-002YSJ-Bx for pgsql-bugs@lists.postgresql.org; Mon, 18 Mar 2024 14:23:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rmDtn-005C6o-P0 for pgsql-bugs@lists.postgresql.org; Mon, 18 Mar 2024 14:23:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 42IENWUF3561574; Mon, 18 Mar 2024 10:23:32 -0400 From: Tom Lane To: Thomas Munro cc: Christophe Pettus , Andrew Dunstan , Wolfgang Walther , PostgreSQL Bugs Subject: Re: Regression tests fail with musl libc because libpq.so can't be loaded In-reply-to: References: <2852940.1710599083@sss.pgh.pa.us> <443da167-ee01-47d2-9c83-105694b4cbd5@technowledgy.de> <68C88EE3-CDCB-4993-9173-3A773F491F3A@thebuild.com> <855a1b16-0dc0-42b2-8f90-79eb49cf2893@technowledgy.de> Comments: In-reply-to Thomas Munro message dated "Tue, 19 Mar 2024 02:25:33 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3561572.1710771812.1@sss.pgh.pa.us> Date: Mon, 18 Mar 2024 10:23:32 -0400 Message-ID: <3561573.1710771812@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > (Hmm, I think it's not that unreasonable on their part to assume the > initial environment is immutable if their implementation doesn't > mutate it, and our doing so is undeniably UB; surprising, maybe, given > that the technique works on that other popular brand of C library on > that kind of kernel, not to mention dozens of old Unixen of yore... Does their implementation also ignore the effects of putenv() or setenv() on LD_LIBRARY_PATH? They have no moral high ground whatsoever if that's the case. But if it doesn't, an alternative route to a solution could be to scan the original environment, strdup and putenv each entry to move it to freshly malloc'd space, and then reclaim the old environment area. regards, tom lane