In perl.git, the branch smoke-me/khw-locale has been created <http://perl5.git.perl.org/perl.git/commitdiff/9e0c2370f6319df6b1ec24cb5f6baab5c0d21584?hp=0000000000000000000000000000000000000000>
at 9e0c2370f6319df6b1ec24cb5f6baab5c0d21584 (commit) - Log ----------------------------------------------------------------- commit 9e0c2370f6319df6b1ec24cb5f6baab5c0d21584 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 23:33:22 2013 -0700 XXX audit posix.t: Correct saving/restoring locales This code assumed that setlocale returned the old locale. Instead it returns the new one. A separate setlocale() call is needed to get the previous locale value. M ext/POSIX/t/posix.t commit e092e284ebba01793107e6c9f21af17a15abcb2d 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 13ce66c9dc73b11ac8cc1ba3b64b4c5e12f9a811 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 23:12:19 2013 -0700 sv.c, 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 sv.c M util.c commit d5ef2d05f257e57257acb3cee2c025ac2213a5be 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 94a1053889b3322d8da49d06bf5aaaddf335e93e 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 a7d3e2a1a1222404adc17a801822274b99b11a62 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 5394fd0e8c45ee42aa357679e575e5c0e8b528d6 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 7a4bb68d3df99bf1ba6c14e738f7bef10754dacc 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 293739341bea8cd2824a8664c297783e2732190b Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 16:53:25 2013 -0700 locale.c, perl.h: Add comments This documents much of what I learned about how things work while tracking down [perl #120723]. M locale.c M perl.h commit ecafa12caaf69fa192ffceeda2dba35c31aed9ec Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 17:58:52 2013 -0700 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 commit 8b717c916352d30be036ed3228817fbc399da7a5 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 16:25:02 2013 -0700 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 locale.c M t/run/locale.t commit 7f14898b60d8435baa6f84845b9d7aa20e62387e Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 16:22:17 2013 -0700 locale.c: White-space only. This outdents code removed from a block by the previous commit M locale.c commit a28bb948cc89f08e5ccbf9df36657278bd9148e3 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 2c39ea4019800e6619b3ba3c6965398c6a7a8639 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 commit 67970d89f9c265a516dca10cacc818eedb89546e Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 11:26:02 2013 -0700 perllocale: Note that LC_MESSAGES affects $^E M pod/perllocale.pod commit 35f575693f3ad5c7a525666a8242f509d84f91b0 Author: Karl Williamson <pub...@khwilliamson.com> Date: Wed Dec 11 09:03:03 2013 -0700 run/locale.t: Fix bareword error This string should be in quotes to be properly eval'd. Prior to this patch this .t failed when run by hand as the bareword warning is made fatal. M t/run/locale.t commit 95e364d113046e5c3a3ab4a0526b59f11e6eb056 Author: Karl Williamson <pub...@khwilliamson.com> Date: Sun Dec 8 09:34:18 2013 -0700 lib/locale.t: Add tests Commit b99851e1941e002dd4816ee6c76fd49bbee1d7f3 should have added tests in two places. This adds them in the second place, plus a cautionary comment. The reason for the two places is the alternative I can think of is to use a string eval, but that perturbs the test environment so might affect the outcome. M lib/locale.t commit cf8a38c07d4af888159da722ce55e76c5fca7cf3 Author: Karl Williamson <pub...@khwilliamson.com> Date: Sun Dec 8 08:42:49 2013 -0700 lib/locale.t: Move some lines Commit b99851e1941e002dd4816ee6c76fd49bbee1d7f3 should have added tests at the end of the block. This moves them. M lib/locale.t ----------------------------------------------------------------------- -- Perl5 Master Repository