Provide error hint on exit() check when building libpq
authorDaniel Gustafsson <[email protected]>
Mon, 4 Oct 2021 12:32:21 +0000 (14:32 +0200)
committerDaniel Gustafsson <[email protected]>
Mon, 4 Oct 2021 12:32:21 +0000 (14:32 +0200)
Commit dc227eb82 introduced a restriction on libpq that no functions which
invoke exit() are allowed to be called. This was further refined and fixed
in e45b0dfa1f and 2f7bae2f92 and 792259591. While this is well documented
in the Makefile, the error message emitted when the check failed was terse,
without hints for new developers without prior context. This adds an error
hint to assist new developers onboarding to postgres.

Author: Rachel Heaton <[email protected]>
Co-authored-by: Jacob Champion <[email protected]>
Discussion: https://postgr.es/m/CADJcwiVL20955HCNzDqz9BEDr6A77pz6-nac5sbZVvhAEMijLg@mail.gmail.com

src/interfaces/libpq/Makefile

index 7cbdeb589bde043e07d178b6d7b586d5ad4a2018..d98bc071439689be8bbc4e2f5f3eafd917b92444 100644 (file)
@@ -115,7 +115,9 @@ backend_src = $(top_srcdir)/src/backend
 libpq-refs-stamp: $(shlib)
 ifneq ($(enable_coverage), yes)
 ifeq (,$(filter aix solaris,$(PORTNAME)))
-   ! nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit
+   @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
    touch $@