In perl.git, the branch smoke-me/khw-locale has been created <http://perl5.git.perl.org/perl.git/commitdiff/dba6eeff182833bd554cd59e904160b70355d212?hp=0000000000000000000000000000000000000000>
at dba6eeff182833bd554cd59e904160b70355d212 (commit) - Log ----------------------------------------------------------------- commit dba6eeff182833bd554cd59e904160b70355d212 Author: Karl Williamson <pub...@khwilliamson.com> Date: Tue Dec 17 13:20:13 2013 -0700 smoke M ext/XS-APItest/t/printf.t M perlio.h M t/porting/customized.dat M t/run/locale.t commit 02ebe615e1f76a9db8cd6c5ea14ba42bb4b8e9ef Author: Karl Williamson <pub...@khwilliamson.com> Date: Tue Dec 17 12:33:42 2013 -0700 07locale.t: 'use locale' needs to be moved A test that is supposed to be outside the scope of 'use locale' is instead within the scope. M cpan/version/t/07locale.t commit 2f7ac53abacdba16ca3930b5b039e62a6df2df74 Author: Karl Williamson <pub...@khwilliamson.com> Date: Tue Dec 17 12:25:31 2013 -0700 cpan/version/t/07locale.t: Tests were likely skipped The logic was wrong in the loop exit, so that on the many machines that don't have an Afghan locale, most tests in the file are skipped. The problem is that it wasn't testing if changing to the trial locale actually worked. M cpan/version/t/07locale.t commit 69c20382c54e4624118c221e5c2e0a05c6aaaff3 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 17:58:52 2013 -0700 XXX perl.c: Remove no-longer necessary function call This call during initialization toggles the LC_NUMERIC locale to the C locale, where it usually stays. But the previous commmit added doing this to the central calls for changing locales, where it should have been all along, so this is no longer necessary. M perl.c M t/run/locale.t commit 5f293d1fd0c2a696687c691a5783a0be013068da Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 16:25:02 2013 -0700 XXX PATCH: [perl #120723] Setting LC_NUMERIC breaks parsing of constants LC_NUMERIC is handled differently than the other locale categories, in that for this category, Perl normally stays in the C locale, converting to the underlying locale for brief periods, only when necessary. This is undocumented (until the commit following this one). The problem was that when POSIX::setlocale() is called, it changes the locale, which is correct only if called during those places where the underlying locale is supposed to be in effect, or if the new locale is the C locale. This commit simply adds code to change the locale back to the C locale if appropriate. M t/run/locale.t commit a7920e727bceaccc9812f6c5c0ef04746b345449 Author: Karl Williamson <pub...@khwilliamson.com> Date: Mon Dec 16 22:40:26 2013 -0700 numeric.c: White-space only Indent and reflow to 79 columns as a result of the previous commit's adding a block around this code. M numeric.c commit 0b9efd27e5c48bcb5e2dee3d8bbad2dee1c33a80 Author: Karl Williamson <pub...@khwilliamson.com> Date: Mon Dec 16 22:34:19 2013 -0700 Use new macros to make sure LC_NUMERIC is correctly set This uses the macros added in the previous commit to make sure the current LC_NUMERIC locale is correct during the operation being done; restoring it to its prior condition afterwards. Outside of 'use locale' the locale should be C; inside it should be the underlying default locale. The macros handle the whole thing. In most of the places here, the code was trying to do what the macros do more elegantly. M numeric.c M pp_ctl.c M sv.c commit 6b2af02358007047be0ba07e197410b4c4ee9161 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 23:15:25 2013 -0700 toke.c: Set locale for all scan_num() calls; restore instead of reset One call of Perl_scan_num changes the locale around it. However, this function is called in several places, including from outside the file. It is better to set the locale within scan_num() at the point where it matters. And, instead of setting the locale unconditionally, it is better to change it only if it needs to be changed, and restore it to the original. Otherwise the locale can be changed to something unexpected. M toke.c commit 0f417c5a192d70c2d0f05a5507c828221d953419 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 23:12:19 2013 -0700 util.c: Use existing macros instead of reinventing them If there had been documentation referring to these macros, I would have known they existed instead of reinventing them (not as well as the originals). M util.c commit b38fa703147d202eb3a89c0d357697f47f9a284f Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 23:04:40 2013 -0700 POSIX:strtod() should restore the locale it changed Prior to this commit, the locale remained as strtod() set it to. I could not find a case where this actually was a problem, as the other code is good about checking for and changing the locale where needed. But uses of atoi(), strtol() in locales where there are spaces in numbers likely would break. M ext/POSIX/POSIX.xs M perl.h M t/run/locale.t commit 6d1093c67cb6cd0134991929108362b46192ec1a Author: Karl Williamson <pub...@khwilliamson.com> Date: Mon Dec 16 21:47:27 2013 -0700 perl.h: Add macros and comments These macros are used in making sure the current locale is the correct one for the circumstances. I'm not a fan of this type of code generation macro, but this just extends what is already there, and aren't all that complicated. M perl.h commit 20872d6aa33a8b654301613f64e94fecc94eb427 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 22:55:43 2013 -0700 perl.h: Revise another locale setting macro We generally don't want to switch to the default underlying locale unless we are in the scope of some form of 'use locale'. Prior to this commit, this code did not allow the switch for 'use locale ":not_characters"'. M perl.h M t/run/locale.t commit 933df2411040817041e5daba70a582fd83c9ae19 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 22:50:28 2013 -0700 perl.h: Revise a locale setting macro This macro toggles to the C locale. It should not depend on being in the scope of 'use locale' to do that, so remove the check. I couldn't figure out a test case for this, but I'm pretty sure there is a some convoluted scheme that this change averts a bug from. M perl.h commit dcce4539a6d329398c9b3c8e7fa27718d6fe2197 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 19:00:15 2013 -0700 locale.c: Avoid writing libc static storage I don't believe this code was causing any problem, but it can overwrite static storage returned by setlocale(). It's safer to create a copy first. M locale.c commit d6c12f79869e0c738ce04e69f2e8307dfdc60710 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 18:04:47 2013 -0700 Hide some undocumented functions from perlapi These functions should not be called from any other places than they are now. They have been marked in the public API as undocumented. I presume they are there because they are called from various parts of the Perl core, so can't be static. But this suppresses them from being listed so people won't be tempted to use them. M embed.fnc commit 10a6be17bdd02617f761e28052ebd703cd251f6e Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 16:53:25 2013 -0700 locale.c: Add comments This documents much of what I learned about how things work while tracking down [perl #120723]. M locale.c commit cbc9fa1a98fa5ff7d20661d2093506b243dea0b2 Author: Karl Williamson <pub...@khwilliamson.com> Date: Thu Dec 12 21:41:10 2013 -0700 locale.c: White-space only Outdent code removed from a block by the previous commit M locale.c commit 38f31da8f06a763091a0a1ffac2fc340ad0089f0 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 14:30:45 2013 -0700 locale.c: Always set state variables for a new locale This function is called when a new underlying LC_NUMERIC locale has been set. If that locale is the same as the current underlying one, some setup is skipped. However, prior to this commit, more was skipped than should have been. The reason is that even if the underlying locale is the same, it could be that LC_NUMERIC has been toggled to the "C" locale, and so the information could be inconsistent. By always setting the information, we ensure consistency. This commit ia a portion of the fix for [perl #120723]. Tests will be added with the final commit for it. M locale.c commit 818d0234e4face8b1ec417e302844ad9a6145af7 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 16:54:49 2013 -0700 perl.h: Move some macro definitions This places related definitions together in the file. M perl.h ----------------------------------------------------------------------- -- Perl5 Master Repository