Re: Regression tests fail with musl libc because libpq.so can't be loaded

From: Wolfgang Walther <walther(at)technowledgy(dot)de>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, peter(at)eisentraut(dot)org, Christophe Pettus <xof(at)thebuild(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Regression tests fail with musl libc because libpq.so can't be loaded
Date: 2024-03-20 14:37:07
Message-ID: c6ee6170-6aa1-436d-bc87-677ffb1c66d5@technowledgy.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Wolfgang Walther 2024-03-20 14:43:05 Re: Regression tests fail with musl libc because libpq.so can't be loaded
Previous Message Tom Lane 2024-03-20 14:36:38 Re: Regression tests fail with musl libc because libpq.so can't be loaded

Browse pgsql-hackers by date

  From Date Subject
Next Message Wolfgang Walther 2024-03-20 14:43:05 Re: Regression tests fail with musl libc because libpq.so can't be loaded
Previous Message Tom Lane 2024-03-20 14:36:38 Re: Regression tests fail with musl libc because libpq.so can't be loaded