blob: fd471ed7a5d849921e3db6f83064e5a737c44d95 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From 289eaf87f8de4d9ebfd661d4e4299c2952435243 Mon Sep 17 00:00:00 2001
2From: Niko Tyni <ntyni@debian.org>
3Date: Fri, 10 Apr 2015 10:19:51 +0300
4Subject: Make t/run/locale.t survive missing locales masked by LC_ALL
5
6If LC_ALL is set to a valid locale but another LC_* setting like LC_CTYPE
7isn't, t/run/locale.t would fail because it explicitly unsets LC_ALL,
8unmasking the problem underneath. All the other tests survive such
9a scenario.
10
11While this is clearly an error in the build environment, it's easy to make
12the test more robust by first clearing all the locale relevant variables.
13
14Bug: https://rt.perl.org/Ticket/Display.html?id=124310
15Bug-Debian: https://bugs.debian.org/782068
16Patch-Name: debian/locale-robustness.diff
17---
18 t/run/locale.t | 7 +++----
19 1 file changed, 3 insertions(+), 4 deletions(-)
20
21diff --git a/t/run/locale.t b/t/run/locale.t
22index bd1a034..2105339 100644
23--- a/t/run/locale.t
24+++ b/t/run/locale.t
25@@ -27,6 +27,9 @@ my @locales = eval { find_locales( [ &LC_ALL, &LC_CTYPE, &LC_NUMERIC ],
26 ) };
27 skip_all("no locales available") unless @locales;
28
29+# reset the locale environment
30+local @ENV{'LANG', (grep /^LC_/, keys %ENV)};
31+
32 plan tests => &last;
33
34 my $non_C_locale;
35@@ -58,9 +61,6 @@ EOF
36 SKIP: {
37 skip("Windows stores locale defaults in the registry", 1 )
38 if $^O eq 'MSWin32';
39- local $ENV{LC_NUMERIC}; # So not taken as a default
40- local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC
41- local $ENV{LANG}; # So not taken as a default
42 fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF',
43 use POSIX qw(locale_h);
44 use locale;
45@@ -348,7 +348,6 @@ EOF
46
47 {
48 local $ENV{LC_NUMERIC} = $different;
49- local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC
50 fresh_perl_is(<<"EOF",
51 use POSIX qw(locale_h);
52