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 1vNpxT-00GXCX-1U for pgsql-bugs@arkaria.postgresql.org; Tue, 25 Nov 2025 10:07:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vNpxS-007hsT-0N for pgsql-bugs@arkaria.postgresql.org; Tue, 25 Nov 2025 10:07:38 +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 1vNpxR-007hsL-2n for pgsql-bugs@lists.postgresql.org; Tue, 25 Nov 2025 10:07:38 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vNpxP-001Mh7-2I for pgsql-bugs@lists.postgresql.org; Tue, 25 Nov 2025 10:07:37 +0000 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-bc2abdcfc6fso3196196a12.2 for ; Tue, 25 Nov 2025 02:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764065255; x=1764670055; 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=KwONKhSFVs1HOx0GbhMFDCF2MfJCxfRU4ehqJM7UyGg=; b=HlfJ2vGH1++FpcIyVnshxxnUjcLPX6YXa/8OrXnaJfIrdFlNEtW9XhduAilkck/iNw on12+0DAbOnYfIsKVIeZKdrRhsOZqroFGP64q9lE8mWUNIhEfqdkl1E+p+0Dju5/MFKL /fBOz3p2KhzrLddrwDHeWRCL93F+JPOlXkF+oMYG1f6ko1PtV5RQuSSdCVygJCsO7T2C jMkdY/2EBd76Vn/dJJJfXyOi+R9YH+eDfkiyuOx7iri2fYv/+CyCKpG0+CSR4r8B7eff C9qTa2pRviTfo1pxU+Ar1bIi3PtY0KWpyMbWe9YwL368hbN6Z5qqgZPAu7mDRwnXTaIU q2nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764065255; x=1764670055; 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=KwONKhSFVs1HOx0GbhMFDCF2MfJCxfRU4ehqJM7UyGg=; b=osEVwY1h60NBaX/9vRTTQ4ftvG1sV+NTVY75G1EnZ9GaKf50yNYJvyxIDTYZnMDj75 Hdmli0whoOobUHkUFo717YgpiWH5lr0UBaXXW8pkUqL5p/Fx8S9l1OZmXBMiHqGzsk7j saw3rVz4M+n3k7ZDnCOSYaZq9Yyrbql2J5LvPz2+kEJ/1qxg/fUnE4cRkqvwGTinYB12 1o1TEFM+JFL0x6UBtNUYMeXzuwfo/TduCF4DdY8b770i7eYBOvyj9Rf6iWhdlmVRpk+W zyXcdCNKgUFbanN2qSJx1IfLCPYxvwojxo+p/C2oJlL0qbGkiB4ilaGqXRXjiOvwMWf0 x8tA== X-Forwarded-Encrypted: i=1; AJvYcCXXrLIde5HlxrjCx9FibtgK/+oZPhWCymK5Q8su9ZwxGfjm6HmU/HSMIhkFSivWQZ14YqqgilkT7DIC@lists.postgresql.org X-Gm-Message-State: AOJu0YxIXlwYb4gpvRL30AGSbv19JDrNPZsZKKxlD/+O/tldg7jtqlqV KzfcRwGElc2bGBAI8OOJ/FNPs1srStIRSofwZ8e0jJ0WaNlCLCIQD73rsKE2bH3/hEJvQDB4v1Q nOwlo3su5/AkOTHXUUFQijLHoI4L7ULejWHDlw/m7Uw== X-Gm-Gg: ASbGncv6oM0g2BUWobRKKNDseb7GxyOloVbq9oYmGiRDbNUMutQy0lgETEAl0ic9g/j +sEWl7ltjqa5M8OcgJoJiLQ5engmfPdsTsdhqbj7p2KWq6iPqS2yoB46VjZAeZL9g1aXD/Z23WN WKuYMRUxYnsTHAcnzaRoa31kfCG4rUNa8Pur8MIkjeyexqpAkSwW77/mSlEFz4SlLc9irmWIk2U p5oIA9Fv/UdEXW+uWVMk37IkTp/YEhMLg+bzQKhMj+e9OTOmi8UUAId0WufzarH6150KQKI X-Google-Smtp-Source: AGHT+IEMUIFxP40a5r8pIBdR/BQOPrf60Nx32A0Ih+L3SvsV7AF1/fJbramgT9tvzCUhDup0cIuEe6Yr8Lkvk8Ixvw0= X-Received: by 2002:a05:7301:2e88:b0:2a4:3593:ddd9 with SMTP id 5a478bee46e88-2a71953cdd9mr8859326eec.6.1764065255265; Tue, 25 Nov 2025 02:07:35 -0800 (PST) MIME-Version: 1.0 References: <19095-6d8256d0c37d4be2@postgresql.org> <2305435.1762929527@sss.pgh.pa.us> <7C7B32ED-5742-49D5-9380-5E02AA5B03C4@yesql.se> <057A2AED-0116-446B-8986-57FDA70CA5A3@yesql.se> In-Reply-To: From: Nazir Bilal Yavuz Date: Tue, 25 Nov 2025 13:07:24 +0300 X-Gm-Features: AWmQ_blLp22E8V1e1pIOdEqIHbn6qa5PRC_vjhWNtE8z8fxJIuRJDaEJ4VagPYM Message-ID: Subject: Re: BUG #19095: Test if function exit() is used fail when linked static To: VASUKI M Cc: Michael Paquier , Daniel Gustafsson , Tom Lane , BharatDB , torsten.rupp@gmx.net, pgsql-bugs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, 25 Nov 2025 at 12:11, VASUKI M wrote: > > On Tue, 25 Nov 2025 at 03:14, Michael Paquier wrote: >> >> Including a reference to "nm" in this comment for meson is definitely >> fine, because it is used as a pre-check in this code with >> find_program. However, shouldn't we document the platform-specific >> exclusions in the perl script itself? As of the patch, the >> explanation is a copy-paste of src/interfaces/libpq/Makefile. I think >> that we'd better group everything together, rather than have the same >> contents explained in two places. Perhaps I would add an extra >> comment in meson.build and the Makefile to document that all the >> platform-relevant details are in the perl script itself. >> > Thanks for this suggestion michael & Nazir for the code,i have made the changes you said > > Also added the check where it scans for nm in the environment if it is not present then it gracefully skips the test. > V3 attached kindly check and review it. Thank you for working on this! diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index da66500..305361f 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile -ifeq (,$(filter solaris,$(PORTNAME))) - @if nm -A -u $< 2>/dev/null | grep -v -e __cxa_atexit -e __tsan_func_exit | grep exit; then \ - echo 'libpq must not be calling any function which invokes exit'; exit 1; \ - fi + # See libpq-exit-check for full platform rules and whitelisting. + $(PERL) libpq-exit-check --input_file $< endif -endif - touch $@ + touch $@ There are unnecessary indentation changes. diff --git a/src/interfaces/libpq/libpq-exit-check b/src/interfaces/libpq/libpq-exit-check new file mode 100755 index 0000000..f500cef --- /dev/null +++ b/src/interfaces/libpq/libpq-exit-check I would prefer more in-line comments instead of the comment at the top but I think this is a preference. diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build index a74e885..1b32eed 100644 --- a/src/interfaces/libpq/meson.build +++ b/src/interfaces/libpq/meson.build +if find_program('nm', required: false, native: true).found() and not get_option('b_coverage') I would delete the 'nm' check there, since we have the same check in the PERL script. This makes the meson.build and the Makefile more similar. Also, I would change the comment at the Makefile and the meson.build with the comment below, otherwise we lose information: # Check for functions that libpq must not call, currently just exit(). # (Ideally we'd reject abort() too, but there are various scenarios where # build toolchains insert abort() calls, e.g. to implement assert().) # Skip the test when profiling, as gcc may insert exit() calls for that. Nitpick: I suggest running pgperltidy [1] on the libq-exit-check PERL file. [1] https://github.com/postgres/postgres/blob/master/src/tools/pgindent/pgperltidy -- Regards, Nazir Bilal Yavuz Microsoft