- Notifications
You must be signed in to change notification settings - Fork587
locale.c: Fix compilation on platforms with only a C locale#22569
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
thesamesam commentedSep 9, 2024
Thank you for this. I will also look into changing Configure to handle things so that this case doesn't arise. But it is a good fallback for Configure failures |
3 tasks
13 tasks
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull requestFeb 11, 2025
Changelog:NAME perldelta - what is new for perl v5.40.1DESCRIPTION This document describes differences between the 5.40.0 release and the 5.40.1 release. If you are upgrading from an earlier release such as 5.39.0, first read perl5400delta, which describes differences between 5.39.0 and 5.40.0.Incompatible Changes There are no changes intentionally incompatible with 5.40.0. If any exist, they are bugs, and we request that you submit a report. See "Reporting Bugs" below.Modules and Pragmata Updated Modules and Pragmata * File::Spec has been upgraded from version 3.90 to 3.91. * Module::CoreList has been upgraded from version 5.20240609 to 5.20250118_40. * warnings has been upgraded from version 1.69 to 1.70.Documentation Changes to Existing Documentation We have attempted to update the documentation to reflect the changes listed in this document. If you find any we have missed, open an issue at <https://github.com/Perl/perl5/issues>.Configuration and Compilation * Fixed compilation on platforms (e.g. "Gentoo Prefix") with only a C locale. [GH #22569 <Perl/perl5#22569>] Bug first reported downstream at bugs.gentoo.org/939014 <https://bugs.gentoo.org/939014>. * Fixed compilation error on some systems due to a typo in a printf() format. [GH #22793 <Perl/perl5#22793>]Testing Tests were added and changed to reflect the other additions and changes in this release.Selected Bug Fixes * Starting in Perl 5.39.8, ""strftime"" in POSIX would crash or produce odd errors (such as "Out of memory in perl:util:safesysmalloc") when given a format string that wasn't actually a string, but a number, "undef", or an object (even one with overloaded string conversion). Now "strftime" stringifies its first argument, as before. [GH #22498 <Perl/perl5#22498>] * Builds with "-msse" and quadmath on 32-bit x86 systems would crash with a misaligned access early in the build. [GH #22577 <Perl/perl5#22577>] * Using "goto" to tail call, or using the call_sv() and related APIs to call, any of trim(), refaddr(), reftype(), ceil(), floor() or stringify() in the "builtin::" package would crash or assert due to a "TARG" handling bug. [GH #22542 <Perl/perl5#22542>] * Fixed an issue where utf8n_to_uvchr() failed to correctly identify certain invalid UTF-8 sequences as invalid. Specifically, sequences that start with continuation bytes or unassigned bytes could cause unexpected behaviour or a panic. This fix ensures that such invalid sequences are now properly detected and handled. This correction also resolves related issues in modules that handle UTF-8 processing, such as Encode. * Fixed a double free error or possible memory leak when failing to compile certain regexps. [GH #21661 <Perl/perl5#21661>]
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
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.
Reported downstream in:https://bugs.gentoo.org/939014. The bug is about being impossible to bootstrap a Gentoo prefix with perl-5.40.0.
A Gentoo prefix is a Linux installation under some custom directory, modifiable by a non-root user. Bootstrapping such an installation starts with a host compiler and a shell and builds packages until the full installation is complete. Because of the nature of perl, it ends up being compiled relatively early during the whole process, before the installation is complete and the user has had the chance to select which locales to generate.
In this situation perl ends up being compiled on a bare system with only the C locale. The code in
Configure
perl5/Configure
Lines 17672 to 17675 in67e8521
LC_ALL
which then takes the secondcase
branchperl5/Configure
Lines 17812 to 17834 in67e8521
PERL_LC_ALL_USES_NAME_VALUE_PAIRS
,PERL_LC_ALL_SEPARATOR
, andPERL_LC_ALL_CATEGORY_POSITIONS_INIT
end up being undefined. Thelocale.c
code, however, assumes that eitherPERL_LC_ALL_USES_NAME_VALUE_PAIRS
or the other two macros are defined which leads to a compilation failure because of the usage ofPERL_LC_ALL_CATEGORY_POSITIONS_INIT
:There is already code:
perl5/locale.c
Lines 649 to 658 in67e8521
PERL_LC_ALL_SEPARATOR
. This is a similar situation in purpose but, becausePERL_LC_ALL_CATEGORY_POSITIONS_INIT
is suppose to be an array initializer and, if generated inside the code, it would require a#include "locale_table.h"
I think it's simpler to replace its single usage point. Themap_LC_ALL_position_to_index
array should still be initialized, even with logically wrong values, to prevent possible out-of-bounds errors in other parts of the code.