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 1vJ3mt-0093Sk-0P for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Nov 2025 05:52: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 1vJ3mo-009Pqp-21 for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Nov 2025 05:52:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vJ3mo-009Pqh-0m for pgsql-bugs@lists.postgresql.org; Wed, 12 Nov 2025 05:52:54 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vJ3mm-006fYj-1t for pgsql-bugs@lists.postgresql.org; Wed, 12 Nov 2025 05:52:53 +0000 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-b6329b6e3b0so272801a12.1 for ; Tue, 11 Nov 2025 21:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762926772; x=1763531572; 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=n9GgPUXn1LiK69LaxztKSil8f5+q7TDCaOoKvj6sAyo=; b=UtdWWrwHOBkQQvWS75ittSHwock5atdi1+zMg5Tz1/Wcyi4eBrwjSCgXRWH+oKFfXG Uv2pFBXen8dTa72YWOCD7BEQQgGiyOJK7nY/ojboHU8c60NQDoQSMeoDbj85MpeZpi0A +xz02WVUgMw9C0gJfGuwvL0nvSjbUnzti/iz033x24gb65qJdjy0PRbjbYDWSUaFLkDn Gm0nboufTa3EJeRke+rvqDhygRVtdGGMqQQ7SdRcKnfXQulkSH6S5+F7s5A3oF67/LmS W1CAqOqtNcfvNjJs7klL1Jqa+0rByaODwqvjaSLBQKpg3ScLF8bwtY2pM+qqRk0Q7UOK Kh4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762926772; x=1763531572; 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=n9GgPUXn1LiK69LaxztKSil8f5+q7TDCaOoKvj6sAyo=; b=qYsucU23iXhs1COZdgBmp1g7T4nJ2XQC5C2VCJVcVqNaOITTQJSdxp0ePb7e1tArSJ TMQGsZFUVP3NFfflHjINsSr1XFVy1LwVN4HqYkGd/gLl6svsdiZwRDYMgzHej8qZfsVF xODtKYiBi7OXPB4zCLHzfASaoSNGS0zl+xVh6/muC0GlTau245WRjkG5XtYoBn9K3BPC 2tPuqLHkml9TpPZsNTrg+tQKcEAZU0lTVm0prc7lnobdfET6CjAxJdcdrqmNZjSNptWV rqJqOqOsOEwzvlh22sszSEK289bN1nw1Yvy47nbsSqUqxLZ9EkSL7aRFive9oE3Pj+fK uKJw== X-Forwarded-Encrypted: i=1; AJvYcCV6agJ9P3Z+J8HNRQZdgCEj/eNahv0kQn12B5YKOjV2KmRLtYva4sjpYXo7uPNnkHURX6OyRwDqxGIn@lists.postgresql.org X-Gm-Message-State: AOJu0YwnyEQMjdTA18sq/AY83Mbeho+e+N8veAgwLSWt3UATLZUNki2g nVE8MqaV9RCH32ieZZL7Acuu42bqoeFI2KZEs1mY/uWx3duD9jeSVta70KD0V74icT5ZnhuETSM U/ugV0k+8JDo0xgrcQ/5+gjpMXm072ZQ= X-Gm-Gg: ASbGnct6MA+SFJTksg9w2OOsrPypBKR9ClAVlKE0qgQGeymhfmffcWLPRRiZ8LJwG1k 0VoWQZlbcQXljvaVmW515rKYrzkXyNXeAaWk+BEjvX0lS1YACKSsRhTwrf52VPw4R1B5nX0b691 /b85ngL1p0behWnLncgGAgccDWQjWnl+aveARI1P7BMXYv2j0hwBJk/Hoa+SE872KgvrF3PR13J nctE4NNox9sWEJKH5lGpgXAc4k1UT+O13TfJrV35IfqjgG6czIeY35zqaqS X-Google-Smtp-Source: AGHT+IH8Uih3oNtflqcTMAiXsEeNyhUUeN+bO3eGdhGvriZHnmrEEm7AzXb8geF/89Gz8ggjKuKLvlYF6GLOb5m99S4= X-Received: by 2002:a17:902:f691:b0:297:e1f5:190b with SMTP id d9443c01a7336-2984094a58fmr66277425ad.22.1762926771547; Tue, 11 Nov 2025 21:52:51 -0800 (PST) MIME-Version: 1.0 References: <19095-6d8256d0c37d4be2@postgresql.org> In-Reply-To: <19095-6d8256d0c37d4be2@postgresql.org> From: BharatDB Date: Wed, 12 Nov 2025 11:23:10 +0530 X-Gm-Features: AWmQ_bl7x4P43Tu_-GA1ObNXHtaS1CfPDQrCnQFWz6JS_NBLyf9cu6RXKjY83zY Message-ID: Subject: Re: BUG #19095: Test if function exit() is used fail when linked static To: torsten.rupp@gmx.net, pgsql-bugs@lists.postgresql.org, michael@paquier.xyz Cc: VASUKI M Content-Type: multipart/mixed; boundary="000000000000fbc8ae06435f5f6a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fbc8ae06435f5f6a Content-Type: multipart/alternative; boundary="000000000000fbc8ac06435f5f68" --000000000000fbc8ac06435f5f68 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > > Hello Hackers, > > While reproducing a static linking issue between libpq and libcrypto.a, > I observed that the Makefile's symbol check incorrectly reports missing > exit() symbols because 'grep exit' also matches 'atexit' and > 'OPENSSL_atexit', etc. > > As discussed in the thread by Michael Paquier > (https://www.postgresql.org/message-id/aQA1obboZFjqjaBI%40paquier.xyz), > it seems a related fix was committed earlier. However, I was able to > reproduce this issue again using PostgreSQL 18 (latest release). > > Steps to reproduce: > nm -A -u ./src/interfaces/libpq/libpq.a > /usr/lib/x86_64-linux-gnu/libcrypto.a 2>/dev/null | grep -v __cxa_atexit = | > grep exit > > Output: > /usr/lib/x86_64-linux-gnu/libcrypto.a:libcrypto-lib-init.o: > U atexit > /usr/lib/x86_64-linux-gnu/libcrypto.a:libdefault-lib-rand_unix.o: > U OPENSSL_atexit > > This falsely triggers an undefined exit() error. > [1]Changing the grep pattern to match the exact symbol ('grep -x exit') > prevents > such false positives. [2]Alternatively, excluding pthread_exit() (similar to > __cxa_atexit) would also avoid the issue. > > But [1] will handle all the false positives instead of just pthread_exi= t .LGTM Expected (after fix): > no output =E2=80=94 no false positives. > > Patch attached.I would love to hear any suggestions from the committers. > Thanks in advance > > Best regards, > Vasuki M > BharatDB, > CDAC Chennai. > --000000000000fbc8ac06435f5f68 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hello Hackers,

While re= producing a static linking issue between libpq and libcrypto.a,
I observ= ed that the Makefile's symbol check incorrectly reports missing
exit= () symbols because 'grep exit' also matches 'atexit' and'OPENSSL_atexit', etc.

As discussed in the thread by Michae= l Paquier
(https://www.postgresql.org/message-id/aQA1obboZFjqjaBI%= 40paquier.xyz),
it seems a related fix was committed earlier. Howeve= r, I was able to
reproduce this issue again using PostgreSQL 18 (latest = release).

Steps to reproduce:
=C2=A0 nm -A -u ./src/interfaces/li= bpq/libpq.a /usr/lib/x86_64-linux-gnu/libcrypto.a 2>/dev/null | grep -v = __cxa_atexit | grep exit

Output:
=C2=A0 /usr/lib/x86_64-linux-gnu= /libcrypto.a:libcrypto-lib-init.o: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 U atexit
=C2=A0 /usr/lib/x86_64-linux-gnu/libcrypto.a:= libdefault-lib-rand_unix.o: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 U OPENSSL_at= exit

This falsely triggers an undefined exit() error. =C2=A0
[1]C= hanging the grep pattern to match the exact symbol ('grep -x exit')= prevents
such false positives.
[2]Alternatively, excluding pthread_exit() (similar t= o
__cxa_atexit) would also avoid the issue.

=C2= =A0 But [1] will handle all the false positives instead of just pthread_exi= t .LGTM

Expe= cted (after fix):
=C2=A0 no output =E2=80=94 no false positives.

= Patch attached.I would love to hear any suggestions from the committers.
=C2=A0 Thanks in advance=C2=A0=C2=A0

Best regards, =C2=A0
Vasuki M = =C2=A0
=C2=A0 =C2=A0 BharatDB,=C2=A0
CDAC Chennai.
--000000000000fbc8ac06435f5f68-- --000000000000fbc8ae06435f5f6a Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-prevent-false-exit-match-in-libpq-static-link-ch.patch" Content-Disposition: attachment; filename="0001-Fix-prevent-false-exit-match-in-libpq-static-link-ch.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_mhvl37mg0 RnJvbSA2YmE3ODRlMjdmNmQyYTcwMjM4MjgyNjNmOTg4YjdhMjcxNmZlNjE0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBCaGFyYXREQlBHIDxiaGFyYXRkYnBnQGdtYWlsLmNvbT4KRGF0 ZTogVHVlLCAxMSBOb3YgMjAyNSAxNzozNjoyOSArMDUzMApTdWJqZWN0OiBbUEFUQ0hdIEZpeDog cHJldmVudCBmYWxzZSBleGl0KCkgbWF0Y2ggaW4gbGlicHEgc3RhdGljIGxpbmsgY2hlY2sKClRo ZSBwcmV2aW91cyBNYWtlZmlsZSBjaGVjayB1c2VkICdncmVwIGV4aXQnLCB3aGljaCBhbHNvIG1h dGNoZWQKc3ltYm9scyBsaWtlICdhdGV4aXQnIGFuZCAnT1BFTlNTTF9hdGV4aXQnIGZyb20gbGli Y3J5cHRvLmEuClRoaXMgY2F1c2VkIGZhbHNlIHBvc2l0aXZlIGxpbmsgZmFpbHVyZXMgd2hlbiBz d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