diff options
author | Karl Williamson <public@khwilliamson.com> | 2014-03-31 11:07:53 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2014-04-01 10:54:40 -0600 |
commit | 52686f2a73483730c9ee6d16084c57a769f58495 (patch) | |
tree | d44c9c94510cb7ee3ff5b28e4a2bf7ad1bdfb2dd /pod/perllocale.pod | |
parent | 9fe6720f1cf52622a44ff26107d224cf30fec4e8 (diff) | |
download | perl-52686f2a73483730c9ee6d16084c57a769f58495.tar.gz |
PATCH: [perl 121317] Gconvert() obeys LC_NUMERIC without "use locale"
This reverts part of bc8ec7cc020d0562094a551b280fd3f32bf5eb04.
leaving LC_NUMERIC set to the C locale at start-up. This allows the
tests for quite a few XS modules to pass, as they (and likely the
modules themselves) are expecting a dot as the decimal point character.
However,such modules remain vulnerable to explicit calls to setlocale()
by the Perl code or other modules,
See the ticket's discussion for ideas on how to fix this better in 5.21
going forward.
I did not add tests because this fix only affects XS code that is not in
the Perl API, and we don't have any infrastructure for testing that.
Building such infrastructure seems to me to be too much for the code
freeze situation we are in, and all this is planned to change very early
in v5.21 anyway.
Diffstat (limited to 'pod/perllocale.pod')
-rw-r--r-- | pod/perllocale.pod | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pod/perllocale.pod b/pod/perllocale.pod index 94734df49e..3a3d6f01b4 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -227,11 +227,17 @@ locale isn't exposed to Perl space. =item * -Perl also provides lite wrappers for XS modules to use some C library -C<printf> functions. These wrappers don't do anything with the locale, -and the underlying C library function is affected by the locale in -effect at the time of the wrapper call. -The affected functions are +XS modules for all categories but C<LC_NUMERIC> get the underlying +locale, and hence any C library functions they call will use that +underlying locale. Perl always initializes C<LC_NUMERIC> to C<"C"> +because too many modules are unable to cope with the decimal point in a +floating point number not being a dot (it's a comma in many locales). +But note that these modules are vulnerable because C<LC_NUMERIC> +currently can be changed at any time by a call to the C C<set_locale()> +by XS code or by something XS code calls, or by C<POSIX::setlocale()> by +Perl code. This is true also for the Perl-provided lite wrappers for XS +modules to use some C library C<printf> functions: +C<Gconvert>, L<my_sprintf|perlapi/my_sprintf>, L<my_snprintf|perlapi/my_snprintf>, and |