Bug#601549: perl: sprintf ignores LC_NUMERIC with constants
Damyan Ivanov
dmn at debian.org
Wed Oct 27 16:36:26 UTC 2010
-=| Niko Tyni, Wed, Oct 27, 2010 at 11:28:42AM +0300 |=-
> Package: perl
> Version: 5.10.1-1
> Tags: patch
> Forwarded: http://rt.perl.org/rt3/Ticket/Display.html?id=78632
>
> A regression in 5.10.1 breaks sprintf and LC_NUMERIC with numeric constants:
>
> perl -Mlocale -MPOSIX=locale_h -e 'setlocale(LC_NUMERIC, "fi_FI") or die; printf("%s should be %g\n", spr
> intf("%g", 2.4), 2.4)'
> 2.4 should be 2,4
>
> (At least de_DE and sv_SE should also do for the locale.)
bg_BG too. I guess any locale that uses decimal separator other than
period is affected. That's a lot of users :)
> This is [perl #78632]. One line patch that disables sprintf()
> constant folding when locales are involved:
>
> diff --git a/op.c b/op.c
> index dc9fd64..a2481af 100644
> --- a/op.c
> +++ b/op.c
> @@ -2466,6 +2466,7 @@ Perl_fold_constants(pTHX_ register OP *o)
> case OP_SLE:
> case OP_SGE:
> case OP_SCMP:
> + case OP_SPRINTF:
> /* XXX what about the numeric ops? */
> if (PL_hints & HINT_LOCALE)
> goto nope;
>
> I think this is a possible candidate for squeeze but may not worth an
> upload by itself.
Hm, can I convince you that it is worth an upload all by itself? :)
I remember being bitten by that behaviour, but can't remember details.
Now that the fix is known, I'd greatly appreciate if I don't have to
remember to avoid such constructs until wheezy comes out :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20101027/5e6f4bf1/attachment.pgp>
More information about the Perl-maintainers
mailing list