-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
broken floating-point source constants after setlocale #22176
Comments
This would have been a release blocker for 5.38 if we had known about it then. But it has since been fixed, so will be in 5.40. I suspect it may be too complicated for a 5.38 maintenance release. But since its original date is so early after the 5.38 freeze, I could be wrong about that. Bisecting the fix led to: commit 5ba25c1
|
I confirmed the problem on FreeBSD-13, and also confirmed that the problem is fixed in blead.
I checked out tag v5.38.2, created a branch and attempted to cherry-pick the commit @khwilliamson identified. I don't know how to interpret the result.
|
@jkeenan For cherry-picking, I get:
Which tells me the commit can't be cherry-picked in isolation. I see that you are using a different commit hash (76298ae vs. 5ba25c1). Not sure what's up with that. |
My bisect led me to a different commit: commit eacceb3 Just in case, here is the bisect log: gh-22176-bisect-log.txt Fortunately, this commit cherry-picks into v5.38.2 (==maint-5.38 currently) cleanly. It doesn't compile as it is, but it does after this obvious patch (needed because d65d6e9 have changed signature of set_numeric_locale in blead): diff --git a/locale.c b/locale.c
index eacffab38f..b7e502b134 100644
--- a/locale.c
+++ b/locale.c
@@ -1920,7 +1920,7 @@ S_new_numeric(pTHX_ const char *newnum, bool force)
* locale is indistinguishable from the C locale. */
if (! force && strEQ(PL_numeric_name, newnum)) {
if (! PL_numeric_underlying_is_standard) {
- set_numeric_standard(__FILE__, __LINE__);
+ set_numeric_standard();
}
return; The fixed v5.38.2+eacceb384 version works for me, the script from the first message prints "ok". Could someone who knows Perl internals please verify that this kind of fix is acceptable to be included into Perl 5.38.x? Upd: created a pull request #22185 with the fix described above. |
Is there anything I could do for this to be fixed sooner? I'm new to Perl community and I don't know how the things are generally done here. If I need to squash commits or to clarify the commit message in PR #22185, please let me know. Or is there a mailing list to discuss this issue and review the fix for it? In the mean time, I'm waiting for this bug to be fixed in 5.38.x because that version is going to be quite well-spread due to e.g. being present in the (fresh) current Ubuntu LTS 24.04. |
@steve-m-hay It looks like we need to release a 5.38 maint |
This is a bug report for perl from a.voloshin@postgrespro.ru,
generated with the help of perlbug 1.43 running under perl 5.38.0.
Module: POSIX
Description
Perl 5.38.x (or, at least, it's POSIX module) seem to break floating-point
constants, making 0 < 0.5 false in some locales after setlocale() in BEGIN block.
Verified to work ok: v5.36.3
Verified as buggy: v5.38.0, v5.38.2
Steps to Reproduce
If I set
LC_NUMERIC=ru_RU.UTF-8
in the environment, this script prints "not ok" under Perl 5.38.x, but "ok" under Perl 5.36.3:
Of course, reproduction requires corresponding locale to be present in the system. On my machine, uncommenting corresponding locale name (ru_RU.UTF-8) in /etc/locale.gen and running sudo locale-gen does the trick.
Expected behavior
Floating-point constants should work with any locales. Yes, in ru_RU.UTF-8 locale
the decimal separator is ",", not ".". But that should not affect parsing the
source code itself. Besides, what are we supposed to write instead, 0 < 0,5 ? That would mean
something else!
To sum up: I expected 0 < 0.5 to be true in any locale, even after setlocale()
in the BEGIN block.
Originally this behaviour was found under Ubuntu 24.04 (which has Perl v5.38.2 shipped as package) with some other module doing "use POSIX / setlocale in the BEGIN block" trick for some other reasons, so it does affect real-world usage.
Flags
Perl configuration
The text was updated successfully, but these errors were encountered: