Skip to content
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

locale.c: Workaround for attributes.pm breakage #20325

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

khwilliamson
Copy link
Contributor

See #20155

The root cause of that problem is that under POSIX 2008, when a thread terminates, it causes thread 0 (the controller) to change to the global locale. Commit a7ff7ac caused perl to pay attention to the environment variables in effect at startup for setting the global locale when using the POSIX 2008 locale API. (Previously only the initial per-thread locale was affected.)

This causes problems when the initial setting was for a locale that uses a comma as the radix character, but the thread 0 is set to a locale that is expecting a dot as a radix character. Whenever another thread terminates, thread 0 was silently changed to using the global locake, and hence a comma. This caused parse errors.

The real solution is to fix thread 0 to remain in its chosen locale. But that fix is not ready in time for 5.37.4, and it is deemed important to get something working for this monthly development release.

This commit changes the initial global LC_NUMERIC locale to always be C, hence uses a dot radix. The vast majority of code is expecting a dot. This is not the ultimate fix, but it works around the immediate problem at hand.

The test case is courtesy @bram-perl

See Perl#20155

The root cause of that problem is that under POSIX 2008, when a thread
terminates, it causes thread 0 (the controller) to change to the global
locale.  Commit a7ff7ac caused perl to pay attention to the environment
variables in effect at startup for setting the global locale when using
the POSIX 2008 locale API.  (Previously only the initial per-thread
locale was affected.)

This causes problems when the initial setting was for a locale that uses
a comma as the radix character, but the thread 0 is set to a locale that
is expecting a dot as a radix character.  Whenever another thread
terminates, thread 0 was silently changed to using the global locake,
and hence a comma.  This caused parse errors.

The real solution is to fix thread 0 to remain in its chosen locale.
But that fix is not ready in time for 5.37.4, and it is deemed important
to get something working for this monthly development release.

This commit changes the initial global LC_NUMERIC locale to always be C,
hence uses a dot radix.  The vast majority of code is expecting a dot.
This is not the ultimate fix, but it works around the immediate problem
at hand.

The test case is courtesy @bram-perl
@khwilliamson khwilliamson merged commit ebb1d9c into Perl:blead Sep 20, 2022
@khwilliamson khwilliamson deleted the nwa20155 branch September 20, 2022 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants