Skip Menu |

This queue is for tickets about the Math-Units-PhysicalValue CPAN distribution.

Report information
The Basics
Id: 111910
Status: resolved
Priority: 0/
Queue: Math-Units-PhysicalValue

People
Owner: jettero [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.0008
Fixed in: (no value)



Subject: Tests fail with German locale and perl >= 5.22.0
With a German locale (LC_ALL=de_DE.UTF-8; but other locales with a non-dot radix are probably also affected), on FreeBSD and Debian systems, with perl 5.22.0, 5.22.1, and 5.23.7: Output from '/usr/bin/make test': PERL_DL_NONLAZY=1 "/usr/perl5.22.0p/bin/perl5.22.0" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_load.t .................. ok # Test 1 got: "6500 ft" (t/05_skydiving.t at line 24) # Expected: "6,500 ft" # t/05_skydiving.t line 24 is: ok( "$dist", "6,500 ft" ); # You shouldn't really have to convert these to strings, # Test 2 got: "151,16 ft/s" (t/05_skydiving.t at line 25) # Expected: "151.16 ft/s" # t/05_skydiving.t line 25 is: ok( "$rate", "151.16 ft/s" ); # perl realizes then $rdate is an obj and "151..." is a string... # Test 3 got: "3761,82 kg*m/s" (t/05_skydiving.t at line 26) # Expected: "3,761.82 kg*m/s" # t/05_skydiving.t line 26 is: ok( "$momentum", "3,761.82 kg*m/s" ); t/05_skydiving.t ............. Failed 3/9 subtests t/10_metric.t ................ ok t/15_exponents.t ............. ok # Test 1 got: "27182818284,59 g" (t/20_longBIGfloats.t at line 16) # Expected: "27,182,818,284.59 g" # t/20_longBIGfloats.t line 16 is: ok( $s1, "27,182,818,284.59 g" ); t/20_longBIGfloats.t ......... Failed 1/1 subtests t/25_scalar_reductions.t ..... ok # Test 1 got: "8,65e5 miles" (t/30_sigfigs.t at line 17) # Expected: "8.65e5 miles" # t/30_sigfigs.t line 17 is: ok( $sun->sci( 3 ), "8.65e5 miles" ); t/30_sigfigs.t ............... Failed 1/1 subtests # Test 1 got: "1024 s^2" (t/35_powers.t at line 17) # Expected: "1,024 s^2" # t/35_powers.t line 17 is: ok( "$time", "1,024 s^2" ); t/35_powers.t ................ Failed 1/2 subtests t/40_some_standard_values.t .. ok t/45_boolean.t ............... ok t/47_compare.t ............... ok t/49_assbackwards.t .......... ok t/50_zero.t .................. ok t/55_exponents.t ............. skipped: (no reason given) t/60_plurals.t ............... ok LC_ALL=C on these systems, or other perl versions even with German locale are fine.
Thanks for taking the time to contact me about this. I've been trying to track this down for years. When I set my locale to any of de, de_DE, de_DE.utf8, de_DE.UTF-8; and other de_* locales that exist on my machine; the output of /bin/ls is affected like I'd expect, but I still can't reproduce the error in perl. Is this something that's only an issue in very new Perls? My latest attempt to address it for the tests is to BEGIN { $ENV{LC_ALL}="C" }; but I also considered POSIX::setlocale("en_US") or something like that. How would you recommend I set up for my tests so the output is predictably LC_NUMERIC=en_US? (There's probably a CPAN Testers page for this. I should have looked there yesterday.) -Paul On Wed Feb 10 03:03:47 2016, SREZIC wrote: Show quoted text
> With a German locale (LC_ALL=de_DE.UTF-8; but other locales with a > non-dot radix are probably also affected), on FreeBSD and Debian > systems, with perl 5.22.0, 5.22.1, and 5.23.7: > > Output from '/usr/bin/make test': > > PERL_DL_NONLAZY=1 "/usr/perl5.22.0p/bin/perl5.22.0" "- > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > t/*.t > t/01_load.t .................. ok > # Test 1 got: "6500 ft" (t/05_skydiving.t at line 24) > # Expected: "6,500 ft" > # t/05_skydiving.t line 24 is: ok( "$dist", "6,500 ft" ); > # You shouldn't really have to convert these to strings, > # Test 2 got: "151,16 ft/s" (t/05_skydiving.t at line 25) > # Expected: "151.16 ft/s" > # t/05_skydiving.t line 25 is: ok( "$rate", "151.16 ft/s" ); > # perl realizes then $rdate is an obj and "151..." is a string... > # Test 3 got: "3761,82 kg*m/s" (t/05_skydiving.t at line 26) > # Expected: "3,761.82 kg*m/s" > # t/05_skydiving.t line 26 is: ok( "$momentum", "3,761.82 kg*m/s" ); > t/05_skydiving.t ............. > Failed 3/9 subtests > t/10_metric.t ................ ok > t/15_exponents.t ............. ok > # Test 1 got: "27182818284,59 g" (t/20_longBIGfloats.t at line 16) > # Expected: "27,182,818,284.59 g" > # t/20_longBIGfloats.t line 16 is: ok( $s1, "27,182,818,284.59 g" > ); > t/20_longBIGfloats.t ......... > Failed 1/1 subtests > t/25_scalar_reductions.t ..... ok > # Test 1 got: "8,65e5 miles" (t/30_sigfigs.t at line 17) > # Expected: "8.65e5 miles" > # t/30_sigfigs.t line 17 is: ok( $sun->sci( 3 ), "8.65e5 miles" > ); > t/30_sigfigs.t ............... > Failed 1/1 subtests > # Test 1 got: "1024 s^2" (t/35_powers.t at line 17) > # Expected: "1,024 s^2" > # t/35_powers.t line 17 is: ok( "$time", "1,024 s^2" ); > t/35_powers.t ................ > Failed 1/2 subtests > t/40_some_standard_values.t .. ok > t/45_boolean.t ............... ok > t/47_compare.t ............... ok > t/49_assbackwards.t .......... ok > t/50_zero.t .................. ok > t/55_exponents.t ............. skipped: (no reason given) > t/60_plurals.t ............... ok > > > LC_ALL=C on these systems, or other perl versions even with German > locale are fine.
-- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.
On 2016-02-10 11:25:07, JETTERO wrote: Show quoted text
> Thanks for taking the time to contact me about this. > > I've been trying to track this down for years. When I set my locale > to any of de, de_DE, de_DE.utf8, de_DE.UTF-8; and other de_* locales > that exist on my machine; the output of /bin/ls is affected like I'd > expect, but I still can't reproduce the error in perl. > > Is this something that's only an issue in very new Perls?
Yes, only with perl >= 5.22.0 Show quoted text
> > My latest attempt to address it for the tests is to BEGIN { > $ENV{LC_ALL}="C" }; but I also considered POSIX::setlocale("en_US") or > something like that. > > How would you recommend I set up for my tests so the output is > predictably LC_NUMERIC=en_US? > > (There's probably a CPAN Testers page for this. I should have looked > there yesterday.)
For former perls, setting $ENV{LC_ALL} was sufficient. In newer perls, it seems that a change like this is necessary: diff --git a/t/05_skydiving.t b/t/05_skydiving.t index 4ed2068..709b60d 100644 --- a/t/05_skydiving.t +++ b/t/05_skydiving.t @@ -1,6 +1,6 @@ # vi:fdm=marker fdl=0 syntax=perl: -BEGIN { $ENV{LC_ALL} = "C" } +BEGIN { use POSIX qw(setlocale LC_ALL); setlocale(LC_ALL, "C") } use strict; use Test; (Probably similar changes are necessary for the other three failing test scripts) Sorry, I cannot say what exactly changed in perl 5.22. perl5220delta.pod lists quite a number of changes regarding to locale handling. Maybe you can ask Karl Williamson (khw at cpan dot org) or the p5p mailing list for details. Regards, Slaven Show quoted text
> > -Paul > > On Wed Feb 10 03:03:47 2016, SREZIC wrote:
> > With a German locale (LC_ALL=de_DE.UTF-8; but other locales with a > > non-dot radix are probably also affected), on FreeBSD and Debian > > systems, with perl 5.22.0, 5.22.1, and 5.23.7: > > > > Output from '/usr/bin/make test': > > > > PERL_DL_NONLAZY=1 "/usr/perl5.22.0p/bin/perl5.22.0" "- > > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > > t/*.t > > t/01_load.t .................. ok > > # Test 1 got: "6500 ft" (t/05_skydiving.t at line 24) > > # Expected: "6,500 ft" > > # t/05_skydiving.t line 24 is: ok( "$dist", "6,500 ft" > > ); > > # You shouldn't really have to convert these to strings, > > # Test 2 got: "151,16 ft/s" (t/05_skydiving.t at line 25) > > # Expected: "151.16 ft/s" > > # t/05_skydiving.t line 25 is: ok( "$rate", "151.16 ft/s" ); > > # perl realizes then $rdate is an obj and "151..." is a string... > > # Test 3 got: "3761,82 kg*m/s" (t/05_skydiving.t at line 26) > > # Expected: "3,761.82 kg*m/s" > > # t/05_skydiving.t line 26 is: ok( "$momentum", "3,761.82 kg*m/s" > > ); > > t/05_skydiving.t ............. > > Failed 3/9 subtests > > t/10_metric.t ................ ok > > t/15_exponents.t ............. ok > > # Test 1 got: "27182818284,59 g" (t/20_longBIGfloats.t at line 16) > > # Expected: "27,182,818,284.59 g" > > # t/20_longBIGfloats.t line 16 is: ok( $s1, "27,182,818,284.59 > > g" > > ); > > t/20_longBIGfloats.t ......... > > Failed 1/1 subtests > > t/25_scalar_reductions.t ..... ok > > # Test 1 got: "8,65e5 miles" (t/30_sigfigs.t at line 17) > > # Expected: "8.65e5 miles" > > # t/30_sigfigs.t line 17 is: ok( $sun->sci( 3 ), "8.65e5 miles" > > ); > > t/30_sigfigs.t ............... > > Failed 1/1 subtests > > # Test 1 got: "1024 s^2" (t/35_powers.t at line 17) > > # Expected: "1,024 s^2" > > # t/35_powers.t line 17 is: ok( "$time", "1,024 s^2" ); > > t/35_powers.t ................ > > Failed 1/2 subtests > > t/40_some_standard_values.t .. ok > > t/45_boolean.t ............... ok > > t/47_compare.t ............... ok > > t/49_assbackwards.t .......... ok > > t/50_zero.t .................. ok > > t/55_exponents.t ............. skipped: (no reason given) > > t/60_plurals.t ............... ok > > > > > > LC_ALL=C on these systems, or other perl versions even with German > > locale are fine.
Ahh, thanks! That explains some things and I can use this commit/patch directly. Awesome.
I can't wait to see if the tests pass on Perls 5.22+