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-12-08 04:41:08
Message-ID: CACTYHzihgbTyYNQsEGcYmfkPd79r+_Jiz+PhN1xW+3NoJGEhyQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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(at)cdac-Aspire-Lite-AL15-41:~/pg-libpq$ src/tools/pgindent/pgperltidy
src/interfaces/libpq/libpq-check.pl

cdac(at)cdac-Aspire-Lite-AL15-41:~/pg-libpq$

cdac(at)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(at)cdac-Aspire-Lite-AL15-41:~/pg-libpq$

Regards,

Vasuki

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2025-12-08 06:10:27 Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized)
Previous Message Tom Lane 2025-12-06 23:32:12 Re: BUG #19340: Wrong result from CORR() function

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-12-08 04:55:19 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Ashutosh Bapat 2025-12-08 04:40:16 Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring