-
Notifications
You must be signed in to change notification settings - Fork 31
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
Case #61
Merged
Merged
Case #61
Conversation
This file contains 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
Locale handling was originally not thread safe. POSIX 2008 created a parallel universe set of locale functions that are thread safe. Since Perl 5.27.9, these are by default used by perl in threaded builds. However, some C libraries, such as X, continue to use the original functions. That means that those libraries don't see the locale as set by Perl, and Perl doesn't see the locale set by these functions. Perl does provide functions callable by XS to cope with this situation. This commit changes Tk to use them. The thread calling Tk is changed to use the locale handling functions used by the X library. As long as only one thread in an application converts, the entire application remains thread safe. (If more than one thread converts, the application becomes non-thread safe, like it was during most of Perl's history.) It is out of Tk's control if the application does this. The perllocale pod gives appropriate cautions about this.
The code as-is no longer compiles due to changes in the API required because of security issues. However this patch causes it to compile back to 5.6.0 as long as ppport.h version 3.55 or later is included. This fix is part of Perl/perl5#17024
The PR looks incomplete, it seems (see CI check results). Is something else needed? ppport.h maybe? |
I don't know what the best thing to do here is. When ppport.h is parsed, it starts output errors as if it thinks it is a perl file instead of a C hdr, like "Bare word". So this commit just skips parsing that file. Maybe there is a better way. It is ok to not parse it, as it won't introduce dependencies.
ppport.h does it.
This function is backported in ppport.h to perl 6.1. There are several reasons to use it. One is security; it has modern security checks that prevent attacks that older perls are vulnerable to. Another is simplicity. Doing this allows the removal of some source lines from this file that now ppport.h takes care of. The final reason is that should Tk work on EBCDIC, this will automatically too.
Instead of calling the Perl function to see if something is alpha, for example, use the macro that properly expands to do the right thing. These macros have all been backported to 5.6.0. Using them avoids several bugs in the released perls. And they are automatically valid on EBCDIC systems, should someone try to use this on such a platform. Also a couple of these were using the libc function. The results of these functions vary depending on the current locale. Perl is generally not supposed to be paying attention to locale, so the use of these is wrong.
This commit changes to use our own case changing algorithm for early perls. This avoids locale sensitivity. There aren't any equivalent Perl macros, as the use of these happens only so early as to be inconsistent with modern ones that have special handling for a few characters which expand to multiple upon changing case. The problems arise only of a subset of characters, and these all have the property that the case mate is 32 ordinal positions away.
5.28 and later looks OK now, but unfortunately it fails for older perls. |
@eserte is this good to merge now? |
I will do checks and hope to get a devel release of Tk until next weekend. |
Sign up for free
to 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.
No description provided.