locale.c: Don't ever use system LC_ALL #20241
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #20231
LC_ALL is a compendium of the individual locale categories, such as
LC_CTYPE, LC_NUMERIC, .... When all categories are in the same locale,
it acts just like an individual category. But when the categories are
not in the same locale, some means must be used to indicate that.
Platforms differ in how they represent this. Alpine uses:
where 'a' is the locale for the category that Alpine has decided is associated with the first position; 'b', the locale for the second position category, and so on. (I don't know what the details are for Alpine). Other platforms separate by a '/' (and may have a different deterministic ordering). And glibc uses a more informative format:
This has the advantage that it's obvious to the reader what is what, and
the order in the string is irrelevant.
It might be possible, but painful, for a Configure probe to figure out
what the syntax is for the current platform. I chose not to do that. A
platform might come along with a novel syntax unanticipated by whatever
probe we came up with.
Instead, perl uses the glibc format internally, and when it needs to get
or set LC_ALL from the system, it loops through each category
individually, so that by the time it has done all of them, LC_ALL will
have been implicitly handled.
The breaking commit a7ff7ac failed to do that.