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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: torsten(dot)rupp(at)gmx(dot)net
Subject: BUG #19095: Test if function exit() is used fail when linked static
Date: 2025-10-27 07:56:38
Message-ID: 19095-6d8256d0c37d4be2@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19095
Logged by: Torsten Rupp
Email address: torsten(dot)rupp(at)gmx(dot)net
PostgreSQL version: 15.14
Operating system: Linux
Description:

Note: occur from version 15.14 or newer.

In src/interfaces/libpq/Makefile is a test if the function "exit()" (or in
general: a function exists with the name part "exit") is used:

libpq-refs-stamp: $(shlib)
ifneq ($(enable_coverage), yes)
ifeq (,$(filter aix solaris,$(PORTNAME)))
@if nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit; then
\
echo 'libpq must not be calling any function which invokes
exit'; exit 1; \
fi
endif
endif

This test fail if libpq is linked static to an application when e. g.
libcrypto is also linked static into libpq which add indirectly a call to
"pthread_exit()".

Possible fix: exclude pthread_exit(), too (like __cxa_atexit), e.g.:

libpq-refs-stamp: $(shlib)
ifneq ($(enable_coverage), yes)
ifeq (,$(filter aix solaris,$(PORTNAME)))
@if nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep -v
pthread_exit | grep exit; then \
echo 'libpq must not be calling any function which invokes
exit'; exit 1; \
fi
endif
endif

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Lori Corbani 2025-10-27 10:21:17 RE: [EXTERNAL]Re: BUG #19094: select statement on postgres 17 vs postgres 18 is returning different/duplicate results
Previous Message Noah Misch 2025-10-27 04:12:41 Re: BUG #19093: Behavioral change in walreceiver termination between PostgreSQL 14.17 and 14.18