develooper Front page | perl.perl5.porters | Postings from May 2013

5.18.0-RC3 test fails on t/run/locale.t with unknown LC_CTYPE

From:
Tokuhiro Matsuno
Date:
May 14, 2013 04:27
Subject:
5.18.0-RC3 test fails on t/run/locale.t with unknown LC_CTYPE
Message ID:
CADTaU+ZBBYaMwMDOmpxiLAq-3kNVWDEgF9geV4Ppocz==yCD4g@mail.gmail.com
I built 5.18.0-RC3 on my ubuntu linux box. I set LC_CTYPE as ja_JP.UTF-8
and it's not configured.

I think the test fails under the unknown LC_CTYPE. Here is a failing result.


% LC_CTYPE=unknown-locale ./perl t/run/locale.t
1..9
ok 1 - no locales where LC_NUMERIC breaks
ok 2 - LC_NUMERIC without setlocale() has no effect in any locale
# using the 'en_BW.utf8' locale for LC_NUMERIC tests
ok 3 - format() does not look at LC_NUMERIC without 'use locale'
not ok 4 - format() looks at LC_NUMERIC with 'use locale'
# Failed test 4 - format() looks at LC_NUMERIC with 'use locale' at ./
test.pl line 925
#      got "4.2"
# expected "4,2"
# PROG:
# use locale;
# format STDOUT =
# @.#
# 4.179
# .
# write;
# STATUS: 0
ok 5 - too late to look at the locale at write() time
not ok 6 - too late to ignore the locale at write() time
# Failed test 6 - too late to ignore the locale at write() time at
./test.plline 925
#      got "4.2"
# expected "4,2"
# PROG:
# use locale;
# format STDOUT =
# @.#
# 4.179
# .
# { no locale; write; }
# STATUS: 0
ok 7 - version does not clobber version
ok 8 - version does not clobber version (via eval)
ok 9 - sprintf() and printf() look at LC_NUMERIC regardless of constant
folding


I unset LC_CTYPE then works fine.

% LC_CTYPE=unknown-locale ./perl t/run/locale.t
1..9
ok 1 - no locales where LC_NUMERIC breaks
ok 2 - LC_NUMERIC without setlocale() has no effect in any locale
# using the 'en_BW.utf8' locale for LC_NUMERIC tests
ok 3 - format() does not look at LC_NUMERIC without 'use locale'
ok 4 - format() looks at LC_NUMERIC with 'use locale'
ok 5 - too late to look at the locale at write() time
ok 6 - too late to ignore the locale at write() time
ok 7 - version does not clobber version
ok 8 - version does not clobber version (via eval)
ok 9 - sprintf() and printf() look at LC_NUMERIC regardless of constant
folding


Here is a proposed patch:

--- t/run/locale.t.org 2013-05-14 13:22:51.038040002 +0900
+++ t/run/locale.t 2013-05-14 13:23:19.194039942 +0900
@@ -89,6 +89,7 @@
     for ($different) {
  local $ENV{LC_NUMERIC} = $_;
  local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC
+ local $ENV{LC_CTYPE};

  fresh_perl_is(<<'EOF', "4.2", {},
 format STDOUT =
@@ -171,6 +172,7 @@
     for ($different) {
  local $ENV{LC_NUMERIC} = $_;
  local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC
+ local $ENV{LC_CTYPE};
  fresh_perl_is(<<'EOF', "$difference "x4, {},
         use locale;
     use POSIX qw(locale_h);


(This issue may happen on older perls)

--
tokuhirom



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