pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anton Voloshin <a.voloshin@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Aleksander Alekseev <aleksander@timescale.com>
Subject: Re: pgsql: psql: add an optional execution-count limit to \watch.
Date: Fri, 26 Apr 2024 17:38:53 +0300
Message-ID: <81b84b74-01ad-4782-9114-86ff842b1fd7@postgrespro.ru> (raw)
In-Reply-To: <4051932.1714098047@sss.pgh.pa.us>
References: <E1pkTFl-001hzA-LR@gemulon.postgresql.org>
	<CAPpHfdv+10Uk6FWjsh3+ju7kHYr76LaRXbYayXmrM7FBU-=Hgg@mail.gmail.com>
	<2929174.1680876023@sss.pgh.pa.us>
	<CAPpHfdtgQVRZOwov-Ei4Rh=gQtFE8Hb9uKkO1d_XYmQ2XEXt0g@mail.gmail.com>
	<CAJ7c6TO9KpYYxoVVseWEQB5KtjWDkt8NfyAeKPcHoe2Jq+ykpw@mail.gmail.com>
	<4032363.1681134882@sss.pgh.pa.us>
	<CAJ7c6TOFPoHVSxaQXfbm38_QN1v4qaugZW0LBTB-Gkvk2UwBQw@mail.gmail.com>
	<4076950.1681139381@sss.pgh.pa.us>
	<CAJ7c6TOVFT0bOEunovQAmZJDiLJ7Dds4YSONi4yOS1GYLvNntA@mail.gmail.com>
	<2748103.1681839252@sss.pgh.pa.us>
	<5ed7d3e2-ca7e-40ad-9de9-e7648576cc01@postgrespro.ru>
	<4051932.1714098047@sss.pgh.pa.us>

On 26/04/2024 05:20, Tom Lane wrote:
> Haven't we worked around that everywhere it matters, in commits such
> as 8421f6bce and 605062227?

Yes, needing 8421f6bce and 605062227 was, perhaps, surprising, but 
reasonable. Unlike breaking floating point constants in the source code. 
But, I guess, you're right and, since it does look like a Perl bug, 
we'll have to work around that in all places where we use floating-point 
constants in Perl code, which are surprisingly few.

 > For me, check-world passes under
 > LANG=ru_RU, even with perl 5.38.2 (where I do confirm that your
 > test script fails).  The buildfarm isn't unhappy either.

Indeed, check-world seems to run fine on my machine and on the bf as well.

Grepping and browsing through, I've only found three spots with \d\.\d 
directly in Perl code as a float, only one of them needs correction.

1. src/test/perl/PostgreSQL/Test/Kerberos.pm in master
src/test/kerberos/t/001_auth.pl in REL_16_STABLE
 >     if ($krb5_version >= 1.15)

I guess adding use locale ':numeric' would be easiest workaround here.
Alternatively, we could also split version into krb5_major_version and 
krb5_minor_version while parsing krb5-config --version's output above, 
but I don't think that's warranted. So I suggest something along the 
lines of 0001-use-numeric-locale-in-kerberos-test-rel16.patch and 
*-master.patch (attached, REL_16 and master need this change in 
different places).

I did verify by providing fake 'krb5-config' that before the fix, with 
LANG=ru_RU.UTF-8 and Perl 5.38.2 and with, say, krb5 "version" 1.13 it 
would still add the "listen" lines to kdc.conf by mistake (presumably, 
confusing some versions of kerberos).

2 and 3. contrib/intarray/bench/create_test.pl
 >     if (rand() < 0.7)
and
 >     if ($#sect < 0 || rand() < 0.1)

PostgreSQL::Test::Utils is not used there, so it's OK, no change needed.

I did not find any other float constants in .pl/.pm files in master (I 
could have missed something).

 > Particularly in
 > this way --- what are we supposed to do, write "if (0 < 0,5)"?
 > That means something else.

Yep. I will try to report this to Perl community later.

-- 
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

Attachments: download all (2 files, .tar.gz)

0001-use-numeric-locale-in-kerberos-test-rel16.patch (text/x-patch, 1.0K) download From bc187cd95f91d5a7fe97ba4ccfaf75b77e2f03c8 Mon Sep 17 00:00:00 2001 From: Anton Voloshin <a.voloshin@postgrespro.ru> Date: Fri, 26 Apr 2024 12:24:49 +0000 Subject: [PATCH] use numeric locale in kerberos test to work around perl bug After b124104e7 we became susceptible to Perl bug (at least on Perl 5.38.2), where on locales with non-dot fractional part separator, floating-point constants in perl source are broken (1.15 would be '1'). Work around that by using numeric locale in this file. --- src/test/kerberos/t/001_auth.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl index d74e4af464e..9475f14d50e 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -23,6 +23,8 @@ use PostgreSQL::Test::Utils; use PostgreSQL::Test::Cluster; use Test::More; use Time::HiRes qw(usleep); +# Work around the Perl 5.38.2 bug: we need floating-point constants. +use locale ':numeric'; if ($ENV{with_gssapi} ne 'yes') { -- 2.43.0
0001-use-numeric-locale-in-kerberos-test-master.patch (text/x-patch, 1.1K) download From d6ee9a5567cea503c211fa41a0f741c71aa60ad5 Mon Sep 17 00:00:00 2001 From: Anton Voloshin <a.voloshin@postgrespro.ru> Date: Fri, 26 Apr 2024 14:23:28 +0000 Subject: [PATCH] use numeric locale in kerberos test to work around perl bug After b124104e7 we became susceptible to Perl bug (at least on Perl 5.38.2), where on locales with non-dot fractional part separator, floating-point constants in perl source are broken (1.15 would be '1'). Work around that by using numeric locale in this file. --- src/test/perl/PostgreSQL/Test/Kerberos.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/perl/PostgreSQL/Test/Kerberos.pm b/src/test/perl/PostgreSQL/Test/Kerberos.pm index f7810da9c1d..2c29c67329e 100644 --- a/src/test/perl/PostgreSQL/Test/Kerberos.pm +++ b/src/test/perl/PostgreSQL/Test/Kerberos.pm @@ -9,6 +9,8 @@ package PostgreSQL::Test::Kerberos; use strict; use warnings FATAL => 'all'; use PostgreSQL::Test::Utils; +# Work around the Perl 5.38.2 bug: we need floating-point constants. +use locale ':numeric'; our ($krb5_bin_dir, $krb5_sbin_dir, $krb5_config, $kinit, $klist, $kdb5_util, $kadmin_local, $krb5kdc, -- 2.43.0

view thread (17+ messages)  latest in thread

Message-ID: <81b84b74-01ad-4782-9114-86ff842b1fd7@postgrespro.ru>
Permalink:  ../81b84b74-01ad-4782-9114-86ff842b1fd7@postgrespro.ru/
Also on:    postgresql.org/message-id/81b84b74-01ad-4782-9114-86ff842b1fd7@postgrespro.ru

 ·  · 

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: pgsql-committers@postgresql.org
  Cc: a.voloshin@postgrespro.ru, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org, aekorotkov@gmail.com, andrew@dunslane.net, aleksander@timescale.com
  Subject: Re: pgsql: psql: add an optional execution-count limit to \watch.
  In-Reply-To: <81b84b74-01ad-4782-9114-86ff842b1fd7@postgrespro.ru>

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

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