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 1vVI2c-000307-2T for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 23:31:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVI2Z-003BZF-2A for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 23:31:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVI2Z-003BZ7-1B for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 23:31:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVI2X-000wqh-24 for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 23:31:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5BFNVcnk2279214; Mon, 15 Dec 2025 18:31:38 -0500 From: Tom Lane To: Bryan Green cc: pgsql-hackers@lists.postgresql.org Subject: Re: PRI?64 vs Visual Studio (2022) In-reply-to: References: <20250331.152829.1921392690375275165.horikyota.ntt@gmail.com> <001bdc3b-ef94-4f24-b017-ac8ff0a2ea55@eisentraut.org> <1372793.1763519315@sss.pgh.pa.us> <1377512.1763522154@sss.pgh.pa.us> <1462038.1763567038@sss.pgh.pa.us> <1881391.1765782112@sss.pgh.pa.us> <1991599.1765818338@sss.pgh.pa.us> <2117910.1765823286@sss.pgh.pa.us> <2128694.1765826341@sss.pgh.pa.us> <2259481.1765831157@sss.pgh.pa.us> Comments: In-reply-to Bryan Green message dated "Mon, 15 Dec 2025 17:10:36 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2279212.1765841498.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 15 Dec 2025 18:31:38 -0500 Message-ID: <2279213.1765841498@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bryan Green writes: > On 12/15/2025 2:39 PM, Tom Lane wrote: >> Hmmm ... the first batch of BF reports show that on some Linux >> machines, it works to set lc_messages to 'C.UTF-8', but nonetheless >> no translation happens. Did you notice any other gating factors? > Yes - the LANGUAGE environment variable. Not it, I think. pg_regress unsets that. Also, I've been able to reproduce the failure here using a Fedora 42 image, and LANGUAGE is definitely not set in that environment. > Do we know what version of libintl is being used on those BF machines? > There are some marked differences between some versions, which makes > this a little more guesswork than it should be. On my Fedora image, there seems to be no libintl.so anywhere; it's certainly not getting linked into Postgres. The routines must be built into libc. rpm says the glibc version is glibc-2.41-11.fc42.x86_64. Judging by buildfarm reports, the behavior changed sometime between Fedora 39 and Fedora 42. strace'ing shows that during "SET lc_messages =3D 'C.UTF-8'", it successfully finds system locale data about C.utf8: recvfrom(10, "Q\0\0\0!SET lc_messages =3D 'C.UTF-8'"..., 8192, 0, NULL, NU= LL) =3D 34 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) =3D= 21 fstat(21, {st_mode=3DS_IFREG|0644, st_size=3D217804320, ...}) =3D 0 mmap(NULL, 217804320, PROT_READ, MAP_PRIVATE, 21, 0) =3D 0x7f935c5f6000 close(21) =3D 0 openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) =3D= 21 fstat(21, {st_mode=3DS_IFREG|0644, st_size=3D2997, ...}) =3D 0 read(21, "# Locale name alias data base.\n#"..., 4096) =3D 2997 read(21, "", 4096) =3D 0 close(21) =3D 0 openat(AT_FDCWD, "/usr/lib/locale/C.UTF-8/LC_MESSAGES", O_RDONLY|O_CLOEXEC= ) =3D -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/C.utf8/LC_MESSAGES", O_RDONLY|O_CLOEXEC)= =3D 21 fstat(21, {st_mode=3DS_IFDIR|0755, st_size=3D29, ...}) =3D 0 close(21) =3D 0 openat(AT_FDCWD, "/usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES", O_R= DONLY|O_CLOEXEC) =3D 21 fstat(21, {st_mode=3DS_IFREG|0644, st_size=3D53, ...}) =3D 0 mmap(NULL, 53, PROT_READ, MAP_PRIVATE, 21, 0) =3D 0x7f937690a000 close(21) =3D 0 openat(AT_FDCWD, "/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) =3D 21 fstat(21, {st_mode=3DS_IFREG|0644, st_size=3D26998, ...}) =3D 0 mmap(NULL, 26998, PROT_READ, MAP_SHARED, 21, 0) =3D 0x7f9376903000 close(21) =3D 0 futex(0x7f93752999a8, FUTEX_WAKE_PRIVATE, 2147483647) =3D 0 sendto(10, "C\0\0\0\10SET\0Z\0\0\0\5I", 15, 0, NULL, 0) =3D 15 This part of the trace seems indistinguishable between an older RHEL system and Fedora 42. But on the older system, when we invoke pg_bindtextdomain, it does open the regress-19.mo file: recvfrom(10, "Q\0\0\0\37SELECT test_translation();\0", 8192, 0, NULL, NULL= ) =3D 32 stat("/home/postgres/pgsql/src/test/regress/regress.so", {st_mode=3DS_IFRE= G|0775, st_size=3D264904, ...}) =3D 0 openat(AT_FDCWD, "/home/postgres/testversion/share/locale/C.UTF-8/LC_MESSA= GES/regress-19.mo", O_RDONLY) =3D -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/postgres/testversion/share/locale/C.utf8/LC_MESSAG= ES/regress-19.mo", O_RDONLY) =3D -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/postgres/testversion/share/locale/C/LC_MESSAGES/re= gress-19.mo", O_RDONLY) =3D 21 fstat(21, {st_mode=3DS_IFREG|0644, st_size=3D2316, ...}) =3D 0 mmap(NULL, 2316, PROT_READ, MAP_PRIVATE, 21, 0) =3D 0x7f9376902000 close(21) =3D 0 brk(NULL) =3D 0x1a52000 brk(0x1a75000) =3D 0x1a75000 openat(AT_FDCWD, "/home/postgres/testversion/share/locale/C.UTF-8/LC_MESSA= GES/postgres-19.mo", O_RDONLY) =3D -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/postgres/testversion/share/locale/C.utf8/LC_MESSAG= ES/postgres-19.mo", O_RDONLY) =3D -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/home/postgres/testversion/share/locale/C/LC_MESSAGES/po= stgres-19.mo", O_RDONLY) =3D -1 ENOENT (No such file or directory) and away we go. On the newer system, there is no attempt to access the .mo file at all. It looks like it's decided that C.UTF-8 isn't really a valid locale and it's just going to ignore everything. regards, tom lane