Re: BUG #19095: Test if function exit() is used fail when linked static

From: VASUKI M <vasukim1992002(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, BharatDB <bharatdbpg(at)gmail(dot)com>, torsten(dot)rupp(at)gmx(dot)net, pgsql-bugs(at)lists(dot)postgresql(dot)org, byavuz81(at)gmail(dot)com
Subject: Re: BUG #19095: Test if function exit() is used fail when linked static
Date: 2025-11-25 09:11:32
Message-ID: CACTYHzhCNsee-4xv-HDhw8zmMWByB7YHLuUHh-bsztgZ94ewpw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, 25 Nov 2025 at 03:14, Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> Including a reference to "nm" in this comment for meson is definitely
> fine, because it is used as a pre-check in this code with
> find_program. However, shouldn't we document the platform-specific
> exclusions in the perl script itself? As of the patch, the
> explanation is a copy-paste of src/interfaces/libpq/Makefile. I think
> that we'd better group everything together, rather than have the same
> contents explained in two places. Perhaps I would add an extra
> comment in meson.build and the Makefile to document that all the
> platform-relevant details are in the perl script itself.
>
> Thanks for this suggestion michael & Nazir for the code,i have made the
changes you said

Also added the check where it scans for nm in the environment if it is not
present then it gracefully skips the test.
V3 attached kindly check and review it.

> I would be also tempted to move the solaris check inside the perl
> script rather than have it duplicated across meson and make, then do
> something based on $Config{osname} instead.
>
Done

Testing performed:
- Built with both autoconf+Makefile and Meson builds.
- Verified the script runs inside Meson via the custom_target and
confirmed with ninja -v.
>grep -R "libpq-exit-check" build.ninja
build src/interfaces/libpq/libpq-refs-stamp: CUSTOM_COMMAND
src/interfaces/libpq/libpq.so.5.19 |
../src/interfaces/libpq/libpq-exit-check /usr/bin/perl
COMMAND = /usr/bin/perl ../src/interfaces/libpq/libpq-exit-check
--input_file src/interfaces/libpq/libpq.so.5.19 --stamp_file
src/interfaces/libpq/libpq-refs-stamp
description = Generating$ src/interfaces/libpq/libpq-exit-check$ with$ a$
custom$ command

- Injected a fake exit() reference into fe-connect.c and ensured the
build fails with the expected error message.
- Confirmed that removing nm causes the script to skip the check cleanly.
- Verified that Meson’s stamp file prevents re-running the check when
libpq.so has not changed.

Regards,
Vasuki M
CDAC-Chennai

Attachment Content-Type Size
v3-0001-libpq-exit-check.patch text/x-patch 6.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2025-11-25 10:07:24 Re: BUG #19095: Test if function exit() is used fail when linked static
Previous Message Michael Paquier 2025-11-24 21:43:43 Re: BUG #19095: Test if function exit() is used fail when linked static

Browse pgsql-hackers by date

  From Date Subject
Next Message BharatDB 2025-11-25 09:16:11 Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Previous Message Chao Li 2025-11-25 08:59:28 Re: Extended Statistics set/restore/clear functions.