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

VASUKI M <vasukim1992002@gmail.com>

From: VASUKI M <vasukim1992002@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Daniel Gustafsson <daniel@yesql.se>, Tom Lane <tgl@sss.pgh.pa.us>, BharatDB <bharatdbpg@gmail.com>, torsten.rupp@gmx.net, pgsql-bugs@lists.postgresql.org, byavuz81@gmail.com
Date: 2025-11-25T09:11:32Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

On Tue, 25 Nov 2025 at 03:14, Michael Paquier <michael@paquier.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