public inbox for [email protected]  
help / color / mirror / Atom feed
Re: BUG #19095: Test if function exit() is used fail when linked static
7+ messages / 4 participants
[nested] [flat]

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2025-12-09 10:23  VASUKI M <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: VASUKI M @ 2025-12-09 10:23 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]; [email protected]

Thanks Michael and Peter for the detailed reviews and for taking the time
to refine and commit the updated version.

Thanks for pointing out that pgperltidy may behave differently across
environments.

On Tue, 9 Dec 2025 at 11:56, Michael Paquier <[email protected]> wrote:

> The attached takes care of the issue here.  Adding that to pgxs_bins
> may look adapted at first glance, but I don't quite see the point in
> exposing this information to PGXS, so pgxs_empty is a better fit?
>
> Thanks for the clarification.Given that PGXS extensions don't appear to
require NM ,IMO adding it to pgxs_empty makes sense to me.It resolves the
Meson warning without exposing unnecessary variables to PGXS users.

Regards,
Vasuki M


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2025-12-09 12:47  Bilal Yavuz <[email protected]>
  parent: VASUKI M <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Bilal Yavuz @ 2025-12-09 12:47 UTC (permalink / raw)
  To: VASUKI M <[email protected]>; +Cc: Michael Paquier <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]

Hi,

On Tue, 9 Dec 2025 at 13:23, VASUKI M <[email protected]> wrote:
>
> Thanks Michael and Peter for the detailed reviews and for taking the time to refine and commit the updated version.
>
> Thanks for pointing out that pgperltidy may behave differently across environments.
>
> On Tue, 9 Dec 2025 at 11:56, Michael Paquier <[email protected]> wrote:
>>
>> The attached takes care of the issue here.  Adding that to pgxs_bins
>> may look adapted at first glance, but I don't quite see the point in
>> exposing this information to PGXS, so pgxs_empty is a better fit?
>>
> Thanks for the clarification.Given that PGXS extensions don't appear to require NM ,IMO adding it to pgxs_empty makes sense to me.It resolves the Meson warning without exposing unnecessary variables to PGXS users.

I agree with both of you. We do the same thing for 'ZIC' binary, so I
think putting it to pgxs_empty is the correct fix.

-- 
Regards,
Nazir Bilal Yavuz
Microsoft






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2025-12-09 23:11  Michael Paquier <[email protected]>
  parent: Bilal Yavuz <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Michael Paquier @ 2025-12-09 23:11 UTC (permalink / raw)
  To: Bilal Yavuz <[email protected]>; +Cc: VASUKI M <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]

On Tue, Dec 09, 2025 at 03:47:13PM +0300, Bilal Yavuz wrote:
> I agree with both of you. We do the same thing for 'ZIC' binary, so I
> think putting it to pgxs_empty is the correct fix.

Thanks for double-checking.  I was not 100% sure if my analysis was
completely right as I was looking at this file for the first time.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2025-12-10 05:14  Michael Paquier <[email protected]>
  parent: Michael Paquier <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Michael Paquier @ 2025-12-10 05:14 UTC (permalink / raw)
  To: Bilal Yavuz <[email protected]>; +Cc: VASUKI M <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]

On Wed, Dec 10, 2025 at 08:11:37AM +0900, Michael Paquier wrote:
> On Tue, Dec 09, 2025 at 03:47:13PM +0300, Bilal Yavuz wrote:
>> I agree with both of you. We do the same thing for 'ZIC' binary, so I
>> think putting it to pgxs_empty is the correct fix.
> 
> Thanks for double-checking.  I was not 100% sure if my analysis was
> completely right as I was looking at this file for the first time.

On top of the rest, I have double-checked the buildfarm and things
seem fine with 4a8e6f43a6b5, so the last piece about pthread_exit() is
now done with 8268e66ac64c.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2026-02-17 12:04  Nazir Bilal Yavuz <[email protected]>
  parent: Michael Paquier <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Nazir Bilal Yavuz @ 2026-02-17 12:04 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: VASUKI M <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]

Hi,

On Wed, 10 Dec 2025 at 08:14, Michael Paquier <[email protected]> wrote:
>
> On Wed, Dec 10, 2025 at 08:11:37AM +0900, Michael Paquier wrote:
> > On Tue, Dec 09, 2025 at 03:47:13PM +0300, Bilal Yavuz wrote:
> >> I agree with both of you. We do the same thing for 'ZIC' binary, so I
> >> think putting it to pgxs_empty is the correct fix.
> >
> > Thanks for double-checking.  I was not 100% sure if my analysis was
> > completely right as I was looking at this file for the first time.
>
> On top of the rest, I have double-checked the buildfarm and things
> seem fine with 4a8e6f43a6b5, so the last piece about pthread_exit() is
> now done with 8268e66ac64c.

In another thread [1], Andres pointed out that we need to create a
stamp file again although it exists. Otherwise, the stamp file will be
older than the inputs and it causes rebuilding. In Andres' own words
from [1]:

```
> +sub create_stamp_file
> +{
> +    # Avoid touching existing stamp file to prevent unnecessary rebuilds
> +    if (!(-f $stamp_file))
> +    {
> +        open my $fh, '>', $stamp_file
> +          or die "can't open $stamp_file: $!";
> +        close $fh;
> +    }
> +}

Won't that *cause* rebuilds? With a stamp file you normally want the stamp
file to be *newer* than the inputs. Which it won't be, if you don't touch it
here.

The only reason it doesn't cause quick rebuilds with meson is that ninja
remembers the timestamps of files an avoids rebuilds if they haven't changed.
```

Andres is right. We have the same problem on this libpq_check.pl,
attached fixes that.

[1] https://postgr.es/m/nxszznj6nkdj2vh5cxvwzpwodsbtui6mqluxnur2y4x7xtkirw%40fbvhy54mluzl

-- 
Regards,
Nazir Bilal Yavuz
Microsoft


Attachments:

  [text/x-patch] Fix-creating-stamp-file-in-the-libpq_check.pl.patch (1.2K, 2-Fix-creating-stamp-file-in-the-libpq_check.pl.patch)
  download | inline diff:
From a2e46d2dc10bd31d63c6a6bb44334e069b2a9605 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <[email protected]>
Date: Tue, 17 Feb 2026 14:27:43 +0300
Subject: [PATCH] Fix creating stamp file in the libpq_check.pl

We don't create stamp files if it already exists. This is wrong, stamp
file needs to be newer than the inputs. If the stamp file is older than
the inputs, it will cause rebuilding.

Reported-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/[email protected]
---
 src/interfaces/libpq/libpq_check.pl | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/interfaces/libpq/libpq_check.pl b/src/interfaces/libpq/libpq_check.pl
index 8a2e29b2d9a..833f5315c3c 100755
--- a/src/interfaces/libpq/libpq_check.pl
+++ b/src/interfaces/libpq/libpq_check.pl
@@ -31,12 +31,9 @@ die "$0: --nm must be specified\n" unless defined $nm_path and -x $nm_path;
 
 sub create_stamp_file
 {
-	if (!(-f $stamp_file))
-	{
-		open my $fh, '>', $stamp_file
-		  or die "can't open $stamp_file: $!";
-		close $fh;
-	}
+	open my $fh, '>', $stamp_file
+	  or die "can't open $stamp_file: $!";
+	close $fh;
 }
 
 # Skip on Windows and Solaris
-- 
2.47.3



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2026-02-18 04:19  VASUKI M <[email protected]>
  parent: Nazir Bilal Yavuz <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: VASUKI M @ 2026-02-18 04:19 UTC (permalink / raw)
  To: Nazir Bilal Yavuz <[email protected]>; +Cc: Michael Paquier <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]

Hi Nazir,

Thank you for pointing this out, and thanks to Andres for the clarification
in the referenced thread.

You are absolutely right — with a stamp file, we need to ensure that its
timestamp is updated unconditionally so that it remains newer than the
inputs. Keeping the existence check (if (! -f ...)) would indeed leave the
stamp file older than the rebuilt library, which can trigger unnecessary
rebuilds in Makefile-based builds.

Although Ninja avoids repeated rebuilds due to its internal tracking, Make
relies purely on timestamps, so the safer and correct behavior is to always
recreate (touch) the stamp file.

The updated implementation without the existence check is therefore the
correct approach.

Regards,
Vasuki M
C-DAC,chennai


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #19095: Test if function exit() is used fail when linked static
@ 2026-02-18 08:19  Michael Paquier <[email protected]>
  parent: VASUKI M <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-02-18 08:19 UTC (permalink / raw)
  To: VASUKI M <[email protected]>; +Cc: Nazir Bilal Yavuz <[email protected]>; Peter Eisentraut <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; BharatDB <[email protected]>; [email protected]; [email protected]

On Wed, Feb 18, 2026 at 09:49:47AM +0530, VASUKI M wrote:
> You are absolutely right — with a stamp file, we need to ensure that its
> timestamp is updated unconditionally so that it remains newer than the
> inputs. Keeping the existence check (if (! -f ...)) would indeed leave the
> stamp file older than the rebuilt library, which can trigger unnecessary
> rebuilds in Makefile-based builds.

Yep, point taken.  I have applied this adjustment a couple of minutes
ago.  Thanks for the report.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-02-18 08:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-09 10:23 Re: BUG #19095: Test if function exit() is used fail when linked static VASUKI M <[email protected]>
2025-12-09 12:47 ` Bilal Yavuz <[email protected]>
2025-12-09 23:11   ` Michael Paquier <[email protected]>
2025-12-10 05:14     ` Michael Paquier <[email protected]>
2026-02-17 12:04       ` Nazir Bilal Yavuz <[email protected]>
2026-02-18 04:19         ` VASUKI M <[email protected]>
2026-02-18 08:19           ` Michael Paquier <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox