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.96) (envelope-from ) id 1vST3S-00FHym-11 for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Dec 2025 04:40:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vST3Q-00EoyA-2l for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Dec 2025 04:40:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vST3Q-00Eoxz-1l for pgsql-bugs@lists.postgresql.org; Mon, 08 Dec 2025 04:40:56 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vST3O-003mcY-0v for pgsql-bugs@lists.postgresql.org; Mon, 08 Dec 2025 04:40:56 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-640e9f5951aso7421331a12.1 for ; Sun, 07 Dec 2025 20:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765168853; x=1765773653; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NAKYXa4gcxwSA8yWTrQis2p5CVzXesQEDgcxoQjmkYY=; b=IWNWGNEh6JDtvp0p1e/DJNobIXYzbIuVKr42Sf0CJIrPfOjUuBxGdN0Hq5s/bJS9S1 R2Opa5FG3hIYR9JSru/usX8nrnSqvwRg+/pmHD1FnPDa9PSec6jKViNyZGSvZZUJQljs nI53iDiwd5IKYGfK9jnZQXu04oGSUQH9f0uJfd3/adNfJ1MivXNY+7FlS/tl4yCuwhCC QxVhDOhUdzMRKHn5a8HTs/KnGzdtbZ+LlQn32g204LcpU+Wud14vGvx0A45EU5qOa64q b2yevtrekg1UOxF0mqYBjWKxI5qr2MSId8cQh9QYr2pjJQgvfRoRvEWbKtzG4wSiY922 UzXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765168853; x=1765773653; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NAKYXa4gcxwSA8yWTrQis2p5CVzXesQEDgcxoQjmkYY=; b=jO6bLmYl+PniSS9mwYxu1HdBWKDhPEI266PzD0xnfEXJAERtadQ177j/D5w8ozoRxw yObXlVYWaY8D1Nt6z7Jj7mo6RrC+zWMoaf4ZSdueSQrMVClQfCHBmzk3oYsl226W1P/d jRZWq89NbCtX9JLwe7A/a9w36q91ZVRLNJRpWYMMdIELj4Go9rOLmouheS015XPiLe0V Gql25fEzG+JJC6eqpDKnTkERyBo3pM5zrW0pkLA4CREWmnsc+HyqvP3dkEuteV1jJWk/ MFZWGSE71JxWDQin3Ie38oHnFf8PqGF2JFjTf7FqSVGvBE61KeCt85T6ZfRUzBCnpZ9x hKhg== X-Forwarded-Encrypted: i=1; AJvYcCUjgQmstJViPIUBKuCaT/JlPdzKPm6/12klD0hwasQh4/syt6enMvkER9V/e38LvXjNTReqTsXH8tY1@lists.postgresql.org X-Gm-Message-State: AOJu0YxfHfsRciUxulHd6XaQBz8ZGjlcEaHXhYoPU0+3HUomFwlShSgl eS3lzYJDrYLW6r5TbRkqJXvQD8D86pF07x6sH2U5aQH7LW0tYWbq9tdFzD96eayhS3INLL00Paw 35LBMoSUlX5CDUAQKM4efpxac+iFjTTA= X-Gm-Gg: ASbGnct8aXoNGxLd6BTmzoUj/2RVP8K/nb35gek+vXAETbHN0j9CUxhLu4OP884LSS0 CL1eDnuyu6Rsn7p38LvH0ERCqplf+GxND+VCoiemTHOO7mr2yxIZWuOkplccSV2MYXHVJLCA1Dy a/Ts2XWYNiQlZdz97Im0EraDFH0Osd/CH2b1pnDVh/Fs7S2+Eh7gIXddUNm8z4SdlysU7EN5qpo MZd43n5UY57cb+/3XtuGdiqk8IXhxNEUkf+pZySWZxfdSaY96mm9VD0KGwM9Pm46Ot+9bAPoYot jF1Jwg== X-Google-Smtp-Source: AGHT+IE/l/xQbI1oEp29jB7Bqb3UTRi8oMRgPnT+d/BNGvQ2cXYmFWhPQpIfhuzQOk496MRrfqGo4OVIrFgF136BJv0= X-Received: by 2002:aa7:c712:0:b0:640:92eb:aa24 with SMTP id 4fb4d7f45d1cf-647a6a598c1mr8864207a12.15.1765168852733; Sun, 07 Dec 2025 20:40:52 -0800 (PST) MIME-Version: 1.0 References: <483765ED-0490-4972-9769-4943716BE204@yesql.se> <22D3D4EC-BCC3-4E52-B5A9-E1C6E363517B@yesql.se> In-Reply-To: From: VASUKI M Date: Mon, 8 Dec 2025 10:11:08 +0530 X-Gm-Features: AQt7F2oA1MrjZHG83iebNvSd2ardyfwT18qg1sDn7Rd53viqyg4YEFie7qlUqoU Message-ID: Subject: Re: BUG #19095: Test if function exit() is used fail when linked static To: Michael Paquier Cc: Daniel Gustafsson , Tom Lane , BharatDB , torsten.rupp@gmx.net, pgsql-bugs@lists.postgresql.org, byavuz81@gmail.com Content-Type: multipart/alternative; boundary="0000000000006f9175064569665f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006f9175064569665f Content-Type: text/plain; charset="UTF-8" Hi Michael, Thanks for checking the v6 patch. Regarding the whitespace comment - I had already ran the pgperltidy on the perl script libpq-check.pl before sending the patch,and I also verified the tab indentation with cat -T to ensure the tabs were being used.FS,The current version of the scripts in v6 should already follow the standard pgindent/pgperltidy formatting If there is still any specific section that appears mis-indented on your side, please let me know and I will adjust it. cdac@cdac-Aspire-Lite-AL15-41:~/pg-libpq$ src/tools/pgindent/pgperltidy src/interfaces/libpq/libpq-check.pl cdac@cdac-Aspire-Lite-AL15-41:~/pg-libpq$ cdac@cdac-Aspire-Lite-AL15-41:~/pg-libpq$ cat -T src/interfaces/libpq/ libpq-check.pl #!/usr/bin/perl # # src/interfaces/libpq/libpq-check.pl # # Copyright (c) 2025, PostgreSQL Global Development Group # # Check that the state of a libpq library. Currently, this script checks # that exit() is not called, because client libraries must not terminate # the host application. # # This script is called by both Makefile and Meson. use strict; use warnings FATAL => 'all'; use Getopt::Long; use Config; my $nm_path; my $input_file; my $stamp_file; my @problematic_lines; Getopt::Long::GetOptions( ^I'nm:s' => \$nm_path, ^I'input_file:s' => \$input_file, ^I'stamp_file:s' => \$stamp_file) or die "$0: wrong arguments\n"; die "$0: --input_file must be specified\n" unless defined $input_file; die "$0: --nm must be specified\n" unless defined $nm_path and -x $nm_path; sub create_stamp_file { ^Iif (!(-f $stamp_file)) ^I{ ^I^Iopen my $fh, '>', $stamp_file ^I^I or die "can't open $stamp_file: $!"; ^I^Iclose $fh; ^I} } # ---- Skip on Windows and Solaris ---- if ( $Config{osname} =~ /MSWin32|cygwin|msys/i ^I|| $Config{osname} =~ /solaris/i) { ^Iexit 0; } # Run nm to scan for symbols. If nm fails at runtime, skip the check. open my $fh, '-|', "$nm_path -A -u $input_file 2>/dev/null" or exit 0; while (<$fh>) { ^I# Set of symbols allowed: ^I# __cxa_atexit - injected by some libcs (e.g., OpenBSD) ^I# __tsan_func_exit - ThreadSanitizer instrumentation ^I# pthread_exit - legitimate thread cleanup ^Inext if /__cxa_atexit/; ^Inext if /__tsan_func_exit/; ^Inext if /pthread_exit/; ^I# Anything containing "exit" is suspicious. ^I# (Ideally we should reject abort() too, but there are various scenarios ^I# where build toolchains insert abort() calls, e.g. to implement assert().) ^Iif (/exit/) ^I{ ^I^Ipush @problematic_lines, $_; ^I} } close $fh; if (@problematic_lines) { ^Iprint "libpq must not be calling any function which invokes exit\n"; ^Iprint "Problematic symbol references:\n"; ^Iprint @problematic_lines; ^Iexit 1; } # Create stamp file, if required if (defined($stamp_file)) { ^Icreate_stamp_file(); } exit 0; cdac@cdac-Aspire-Lite-AL15-41:~/pg-libpq$ Regards, Vasuki --0000000000006f9175064569665f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Michael,

Thanks for checking the v6 patch.
<= br>
Regarding the whitespace comment - I had already ran the pgperltidy= =C2=A0on the perl
script libpq-= check.pl before=C2=A0 sending the patch,and I also verified the tab ind= entation=C2=A0
with cat -T=C2=A0 to ensure the tabs were being us= ed.FS,The current version of the scripts in=C2=A0
v6 should alrea= dy follow the standard pgindent/pgperltidy=C2=A0formatting
If there is still any specific section that appears mis-indented on your s= ide,
please let me know and I will adjust it.

cdac@cdac-Aspire-Li= te-AL15-41:~/pg-libpq$ src/tools/pgindent/pgperltidy src/interfaces/libpq/<= a href=3D"http://libpq-check.pl">libpq-check.pl

cdac@cdac-Aspire= -Lite-AL15-41:~/pg-libpq$

cdac@cdac-Aspire-Lite-AL15-41:~/pg-libpq$ = cat -T src/interfaces/libpq/libpq-check.p= l
#!/usr/bin/perl
#
# src/interfaces/libpq/libpq-check.pl
#
# Copyright (c) 2025, PostgreSQL = Global Development Group
#
# Check that the state of a libpq library.= =C2=A0 Currently, this script checks
# that exit() is not called, becaus= e client libraries must not terminate
# the host application.
#
# = This script is called by both Makefile and Meson.

use strict;
use= warnings FATAL =3D> 'all';

use Getopt::Long;
use Conf= ig;

my $nm_path;
my $input_file;
my $stamp_file;
my @proble= matic_lines;

Getopt::Long::GetOptions(
^I'nm:s' =3D> \= $nm_path,
^I'input_file:s' =3D> \$input_file,
^I'stamp= _file:s' =3D> \$stamp_file) or die "$0: wrong arguments\n"= ;

die "$0: --input_file must be specified\n" unless define= d $input_file;
die "$0: --nm must be specified\n" unless defin= ed $nm_path and -x $nm_path;

sub create_stamp_file
{
^Iif (!(-= f $stamp_file))
^I{
^I^Iopen my $fh, '>', $stamp_file
^= I^I =C2=A0or die "can't open $stamp_file: $!";
^I^Iclose $= fh;
^I}
}

# ---- Skip on Windows and Solaris ----
if ( =C2= =A0 $Config{osname} =3D~ /MSWin32|cygwin|msys/i
^I|| $Config{osname} =3D= ~ /solaris/i)
{
^Iexit 0;
}

# Run nm to scan for symbols.= =C2=A0 If nm fails at runtime, skip the check.
open my $fh, '-|'= , "$nm_path -A -u $input_file 2>/dev/null"
=C2=A0 or exit 0= ;

while (<$fh>)
{

^I# Set of symbols allowed:
^I#= =C2=A0 =C2=A0 __cxa_atexit =C2=A0 =C2=A0 - injected by some libcs (e.g., O= penBSD)
^I# =C2=A0 =C2=A0 __tsan_func_exit - ThreadSanitizer instrumenta= tion
^I# =C2=A0 =C2=A0 pthread_exit =C2=A0 =C2=A0 - legitimate thread cl= eanup

^Inext if /__cxa_atexit/;
^Inext if /__tsan_func_exit/;
= ^Inext if /pthread_exit/;

^I# Anything containing "exit" i= s suspicious.
^I# (Ideally we should reject abort() too, but there are v= arious scenarios
^I# where build toolchains insert abort() calls, e.g. t= o implement assert().)
^Iif (/exit/)
^I{
^I^Ipush @problematic_lin= es, $_;
^I}
}
close $fh;

if (@problematic_lines)
{
^I= print "libpq must not be calling any function which invokes exit\n&quo= t;;
^Iprint "Problematic symbol references:\n";
^Iprint @pr= oblematic_lines;

^Iexit 1;
}

# Create stamp file, if requi= red
if (defined($stamp_file))
{
^Icreate_stamp_file();
}
exit 0;
cdac@cdac-Aspire-Lite-AL15-41:~/pg-libpq$

Regards,
Vasuki

--0000000000006f9175064569665f--