Re: BUG #19095: Test if function exit() is used fail when linked static - Mailing list pgsql-bugs

From Torsten Rupp
Subject Re: BUG #19095: Test if function exit() is used fail when linked static
Date
Msg-id e0155061-3b5b-4339-9697-acdfdfbb8476@gmx.net
Whole thread Raw
In response to BUG #19095: Test if function exit() is used fail when linked static  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
Dear developers,

I opened this request for a behavior concerning functions with the name
part "exit":

 > Bug reference:      19095
> Logged by:          Torsten Rupp
> Email address:      torsten.rupp@gmx.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

BTW: if you wonder about static linkage: I'm aware of the disadvantages,
but I use static linkage for a backup tool which should run e. g. in any
live Linux from a USB medium, thus it should have as less dependencies
to shared libraries as possible. A non-static version of the tool is
also available. The issue does not occur with shared libraries, because
then no function with the name part "exit" is linked into libpq.

Thank you for your attention.

Best regards, Torsten Rupp





pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19105: Parallel Hash Join crash when work_mem is small
Next
From: Tzuriel Kahlon
Date:
Subject: ecpg Fetch issue