develooper Front page | perl.perl5.porters | Postings from April 2019

Re: [perl #133945] ce6f496d720f6206455628425320badd95b07372 breaksfloat formatting under GTK

Thread Previous | Thread Next
From:
Karl Williamson
Date:
April 15, 2019 17:06
Subject:
Re: [perl #133945] ce6f496d720f6206455628425320badd95b07372 breaksfloat formatting under GTK
Message ID:
f3fe1887-b483-0147-1216-1896dee047b6@khwilliamson.com
On 3/20/19 12:03 PM, Dmitry Karasik (via RT) wrote:
> # New Ticket Created by  Dmitry Karasik
> # Please include the string:  [perl #133945]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=133945 >
> 
> 
> This is a bug report for perl from dmitry@karasik.eu.org,
> generated with the help of perlbug 1.41 running under perl 5.29.2.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> ce6f496d720f6206455628425320badd95b07372 changed float/double formatting
> from strtoflt128 to Perl_strtod, which had a nasty side effect when running
> under non-english locales (or I suspect with locales that use comma for decimal point)
> together with GTK or any other library that calls setlocale() itself.
> 
> The test for this is rather elaborate, so I'm attaching a localebug module
> that tests for it when run 'make test'. One needs the following (for Ubuntu, for
> example):
> 
> * apt-get install libgtk2.0-dev (gtk development files)
> * cpan ExtUtils::PkgConfig
> * locale-gen de_DE.UTF-8 && update-locale (tests need de_DE.UTF-8)
> 
> When running with a faulty configuration, the core issue is basically this:
> 
>      my $s = sprintf "%s", 4.9999;
>      die "bug:$s" if $s !~ /^4[,.]9999$/;
> 
> which prints just "4".
> 
> The module attached can also be found at http://karasik.eu.org/misc/localebug-1.00.tar.gz
> 
> [Please do not change anything below this line]
>

I tried your (thoughtfully included) test bed, making sure that perl.h 
was changed to call straight strtod(), and couldn't get it to fail.

But I created a branch where I wrap Perl_strtod() with calls to use the 
proper radix character.  Please try it out and report back.

It's at
https://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-me/khw-strtod

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About