pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wolfgang Walther <walther@technowledgy.de>
To: Bruce Momjian <bruce@momjian.us>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: peter@eisentraut.org, Christophe Pettus <xof@thebuild.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: PostgreSQL Bugs <pgsql-bugs@lists.postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Regression tests fail with musl libc because libpq.so can't be loaded
Date: Wed, 20 Mar 2024 15:37:07 +0100
Message-ID: <c6ee6170-6aa1-436d-bc87-677ffb1c66d5@technowledgy.de> (raw)
In-Reply-To: <ZfrmN4WHuJgD95fw@momjian.us>
References: <3561573.1710771812@sss.pgh.pa.us>
	<CA+hUKG+Tq3GK7bPd03N0Eox3YY4-Hjd7qQjo_QZFjdbhTqQGQA@mail.gmail.com>
	<CA+hUKGK9LUq=uygBRFt3vFO1RL+_scsT4+hMkvea_zTttHZ59Q@mail.gmail.com>
	<ZfolyUQw9z1zxX58@momjian.us>
	<CA+hUKG+Y1D2Bv9v0GbYrhiQ+mhf=6Xj2_viiATnBVFShkfO4VQ@mail.gmail.com>
	<4093813.1710899588@sss.pgh.pa.us>
	<CA+hUKGKNK5V8XwwJJZm36s3EUy8V51xu4XiE8=26n=Wq3OGd4A@mail.gmail.com>
	<4095435.1710900216@sss.pgh.pa.us>
	<CA+hUKGK2cSx3dveMqBD+E9N=zJ0WawBcbk_jnPqmdWBM0DT_3Q@mail.gmail.com>
	<477fa513-6bf0-456d-8d24-1e22a19df671@technowledgy.de>
	<ZfrmN4WHuJgD95fw@momjian.us>

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





view thread (86+ messages)  latest in thread

Message-ID: <c6ee6170-6aa1-436d-bc87-677ffb1c66d5@technowledgy.de>
Permalink:  ../c6ee6170-6aa1-436d-bc87-677ffb1c66d5@technowledgy.de/
Also on:    postgresql.org/message-id/c6ee6170-6aa1-436d-bc87-677ffb1c66d5@technowledgy.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: walther@technowledgy.de, bruce@momjian.us, thomas.munro@gmail.com, xof@thebuild.com, andrew@dunslane.net, pgsql-bugs@lists.postgresql.org, tgl@sss.pgh.pa.us
  Subject: Re: Regression tests fail with musl libc because libpq.so can't be loaded
  In-Reply-To: <c6ee6170-6aa1-436d-bc87-677ffb1c66d5@technowledgy.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox