[Reproducible-commits] [perl] 05/36: Make t/run/locale.t survive missing locales masked by LC_ALL

Mattia Rizzolo mattia at mapreri.org
Tue Nov 17 14:00:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

mapreri-guest pushed a commit to branch pu/reproducible_builds
in repository perl.

commit 13051e6eb3d5420cd08051d8437b5d56774ee6b0
Author: Niko Tyni <ntyni at debian.org>
Date:   Fri Apr 10 10:19:51 2015 +0300

    Make t/run/locale.t survive missing locales masked by LC_ALL
    
    If LC_ALL is set to a valid locale but another LC_* setting like LC_CTYPE
    isn't, t/run/locale.t would fail because it explicitly unsets LC_ALL,
    unmasking the problem underneath. All the other tests survive such
    a scenario.
    
    While this is clearly an error in the build environment, it's easy to make
    the test more robust by first clearing all the locale relevant variables.
    
    Bug: https://rt.perl.org/Ticket/Display.html?id=124310
    Bug-Debian: https://bugs.debian.org/782068
    Patch-Name: debian/locale-robustness.diff
---
 t/run/locale.t | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/t/run/locale.t b/t/run/locale.t
index 3483f02..ddf8382 100644
--- a/t/run/locale.t
+++ b/t/run/locale.t
@@ -24,6 +24,9 @@ my $have_strtod = $Config{d_strtod} eq 'define';
 my @locales = eval { find_locales( [ &LC_ALL, &LC_CTYPE, &LC_NUMERIC ] ) };
 skip_all("no locales available") unless @locales;
 
+# reset the locale environment
+local @ENV{'LANG', (grep /^LC_/, keys %ENV)};
+
 plan tests => &last;
 fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF',
     use POSIX qw(locale_h);
@@ -39,9 +42,6 @@ EOF
 SKIP: {
     skip("Windows stores locale defaults in the registry", 1 )
                                                             if $^O eq 'MSWin32';
-    local $ENV{LC_NUMERIC}; # So not taken as a default
-    local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC
-    local $ENV{LANG};   # So not taken as a default
     fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF',
         use POSIX qw(locale_h);
         use locale;
@@ -256,7 +256,6 @@ EOF
 
     for ($different) {
 	local $ENV{LC_NUMERIC} = $_;
-	local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC
 	fresh_perl_is(<<"EOF",
 	    use POSIX qw(locale_h);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/perl.git



More information about the Reproducible-commits mailing list