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 1rmx4A-00AnhQ-9q for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Mar 2024 14:37:18 +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 1rmx48-005bLE-RL for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Mar 2024 14:37:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rmx48-005bL6-JY for pgsql-bugs@lists.postgresql.org; Wed, 20 Mar 2024 14:37:17 +0000 Received: from dd25110.kasserver.com ([85.13.146.49]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rmx41-005VeA-7A for pgsql-bugs@lists.postgresql.org; Wed, 20 Mar 2024 14:37:15 +0000 Received: from [192.168.0.101] (ip-037-201-153-175.um10.pools.vodafone-ip.de [37.201.153.175]) by dd25110.kasserver.com (Postfix) with ESMTPSA id 0426AE1A0159; Wed, 20 Mar 2024 15:37:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=technowledgy.de; s=kas202308201259; t=1710945428; bh=sMzcZMyCgVqV3c8jNuzrTYLBsMQPAvAqftfwZg6ITis=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=KS0k5zHcUOQhvOv8ymY3flhvNG3PEStyCyJFo1tHS6YWoNvgLuilnGPdYgmvm0x1t 3TOGappXsX+23/P9uZZ/qUdl9AX0tXk+7ySLxMiB1oPg5IvFxnlBBNNX+1mRfYOMoc zwSLkbK+TNUjXTkhg1PAT2x4zUvO7NZL3PWG+dr6KkqUe9cOVUTlW1sBjaB1MIiBjj QXklxTuDK1KeAoNPSBstubYcRLcwZl7J2fhi+SKYF8noF7uORPgtWU3vzAafKu0m5F os1rsPccnz7kHZZQhPh+XduvNCZXrYSurcZGy4iDyHpHcrM0dpuRwaj5vSGEC0Y8p3 7nQo/Kjmd3OzQ== Message-ID: Date: Wed, 20 Mar 2024 15:37:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Wolfgang Walther Subject: Re: Regression tests fail with musl libc because libpq.so can't be loaded Content-Language: en-US To: Bruce Momjian Cc: Thomas Munro , peter@eisentraut.org, Christophe Pettus , Andrew Dunstan , PostgreSQL Bugs , Tom Lane References: <3561573.1710771812@sss.pgh.pa.us> <4093813.1710899588@sss.pgh.pa.us> <4095435.1710900216@sss.pgh.pa.us> <477fa513-6bf0-456d-8d24-1e22a19df671@technowledgy.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: + List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bruce Momjian: > On Wed, Mar 20, 2024 at 10:39:20AM +0100, Wolfgang Walther wrote: >> Peter Eisentraut: >>> We could turn it around and do >>> >>> #if defined(__linux__) >>> #if defined(__GLIBC__) || defined(__UCLIBC__ ) >>> #define PS_USE_CLOBBER_ARGV >>> #else >>> #define PS_USE_NONE >>> #endif >>> #endif >> >> This works as well. > > Yes, I prefer this. I am worried the environ hackery will bite us > someday and the cause will be hard to find. Well, the environ hackery already bit and it sure was hard to find. But this approach would still clobber environ happily... which is undefined behavior. But certainly the opt-in to known-to-be-good libc variants is a better approach than before. Between this and "stop clobbering at LD_LIBRARY_PATH", I prefer the latter, though. >> I also put together a PoC of what was mentioned in musl's mailing list: >> Instead of clobbering environ at all, exec yourself again with padded argv0. >> This works, too. Attached. > > It is hard to imagine why we would add an extra exec on every Linux > server start for this. Would this be a problem? For a running server this would happen only once when the postmaster starts up, AFAICT. Best, Wolfgang