public inbox for [email protected]  
help / color / mirror / Atom feed
From: Thomas Munro <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: [email protected]
Subject: Re: CI CompilerWarnings test fails on 15 in mingw_cross_warning
Date: Thu, 28 Nov 2024 18:09:46 +1300
Message-ID: <CA+hUKG+EpYkmANS3BeWacMD39k9MjGEo73qJvZfpSA7ggrADgw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <t2vjrcb3bloxf5qqvxjst6r7lvrefqyecxgt2koy5ho5b5glr2@yuupmm6whgob>
	<[email protected]>

On Tue, Nov 19, 2024 at 12:09 AM Peter Eisentraut <[email protected]> wrote:
> The more interesting patch is 495ed0ef2d7, which did
>
> -       collversion = psprintf("%d.%d,%d.%d",
> +       collversion = psprintf("%ld.%ld,%ld.%ld",

This platform has sizeof(int) == sizeof(long), so it doesn't matter.

> whereas my patch just did
>
> -       collversion = psprintf("%ld.%ld,%ld.%ld",
> +       collversion = psprintf("%lu.%lu,%lu.%lu",

I was worried the numbers might have been negative, but those
expressions don't appear to allow that.  Strings observed in real life
are like "1539.5,1539.5" (which bears a passing resemblance to an ICU
version, it has a few fairly low-valued human-originated numbers like
a Unicode version swizzled around in a fairly small number of bits,
but it doesn't matter too match how it works, it's enough to see that
we shift down and mask).

So I think it's OK to back-patch that change.  See attached.

As for why now, I think both fairywren and CI started warning/failing
about 2 months ago[1][2], and that's when fairywren got a uname -r
upgrade, so I guess msys was upgraded; as for CI I guess you'd have to
check for the relevant ming-cross packages moving in Debian.
Unfortunately there were a lot of random CI failures around that time
and I didn't notice this particular circus at the time.

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=fairywren&dt=2024-10-02%2003%3A57%3A44
[2] https://github.com/postgres/postgres/runs/30890390821


Attachments:

  [text/x-patch] 0001-Fix-MinGW-d-vs-lu-warnings-in-back-branches.patch (1.8K, ../CA+hUKG+EpYkmANS3BeWacMD39k9MjGEo73qJvZfpSA7ggrADgw@mail.gmail.com/2-0001-Fix-MinGW-d-vs-lu-warnings-in-back-branches.patch)
  download | inline diff:
From dce109fcd0da3c1379cd64389d03fdef18b52b54 Mon Sep 17 00:00:00 2001
From: Thomas Munro <[email protected]>
Date: Thu, 28 Nov 2024 16:38:03 +1300
Subject: [PATCH] Fix MinGW %d vs %lu warnings in back branches.

Commit 352f6f2d used %d to format DWORD values (unsigned long) with
psprintf().  It has format-string checking under gcc, and gcc doesn't
like it.  It seems that MinGW has started compiling this code in recent
versions, perhaps due to a _WINNT value change, so now we see the
warnings.

Commits 495ed0ef and a9bc04b2 already changed it to %lu in 16+.  In
13-15, build farm animal fairywren began warning a couple of months ago,
and in 15 (the first branch with CI) the CompilerWarnings
mingw_cross_warning step began failing around the same time.

This fixes the warning without any change in behavior, because
sizeof(int) == sizeof(long) on this platform and the values are computed
with DWORD expressions that cannot exceed INT_MAX or LONG_MAX.

Back-patch the formatting change from those commits into 13-15.

Reported-by: Andres Freund <[email protected]>
Reviewed-by:
Discussion: https://postgr.es/m/t2vjrcb3bloxf5qqvxjst6r7lvrefqyecxgt2koy5ho5b5glr2%40yuupmm6whgob
---
 src/backend/utils/adt/pg_locale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 8f841c1d192..3646c979498 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -1760,7 +1760,7 @@ get_collation_actual_version(char collprovider, const char *collcollate)
 							collcollate,
 							GetLastError())));
 		}
-		collversion = psprintf("%d.%d,%d.%d",
+		collversion = psprintf("%lu.%lu,%lu.%lu",
 							   (version.dwNLSVersion >> 8) & 0xFFFF,
 							   version.dwNLSVersion & 0xFF,
 							   (version.dwDefinedVersion >> 8) & 0xFFFF,
-- 
2.47.0



view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: CI CompilerWarnings test fails on 15 in mingw_cross_warning
  In-Reply-To: <CA+hUKG+EpYkmANS3BeWacMD39k9MjGEo73qJvZfpSA7ggrADgw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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