Bug#930095: perl: FTBFS when invoked by sbuild with broken environment inside

Dominic Hargreaves dom at earth.li
Thu Jun 6 21:11:54 BST 2019


Package: perl
Version: 5.28.1-6
Severity: important
Tags: upstream patch

Perl FTBFS in environments where sbuild is run in such a way that
LANG is propagated to the sbuild environmment, but the locale it
references is missing.

Patch attached, which I will apply.
-------------- next part --------------
From 26fb83d00925234e9c5617b9ed4ebd693a1aae46 Mon Sep 17 00:00:00 2001
From: Dominic Hargreaves <dom at earth.li>
Date: Thu, 6 Jun 2019 21:02:25 +0100
Subject: [PATCH] Fix pathological test failure case in ext/POSIX/t/mb.t

This new test fails in an environment where LANG is set to one thing and
LC_ALL is set to another, and where LANG is set to a locale which is
not installed in the environment in question.

Such a test environment is arguably broken, but appears in common
chroot setups such as Debian's sbuild tool where LANG is inherited from
the parent environment, and LC_ALL is used to override it.

Patch-Name: fixes/posix-mb-sbuild-fix.diff
---
 ext/POSIX/t/mb.t | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ext/POSIX/t/mb.t b/ext/POSIX/t/mb.t
index 961edf6cf2..cdd0808eee 100644
--- a/ext/POSIX/t/mb.t
+++ b/ext/POSIX/t/mb.t
@@ -33,9 +33,13 @@ SKIP: {
     my $utf8_locale = find_utf8_ctype_locale();
     skip("no utf8 locale available", 2) unless $utf8_locale;
 
+    # Here we need to influence LC_CTYPE, but it's not enough to just
+    # set this because LC_ALL could override it. It's also not enough
+    # to delete LC_ALL because it could be used to override other
+    # variables such as LANG in the underlying test environment.
+    # Continue to set LC_CTYPE just in case...
     local $ENV{LC_CTYPE} = $utf8_locale;
-    local $ENV{LC_ALL};
-    delete $ENV{LC_ALL};
+    local $ENV{LC_ALL} = $utf8_locale;
 
     fresh_perl_is(
       'use POSIX; print &POSIX::mblen("\x{c3}\x{28}", &POSIX::MB_CUR_MAX)',
-- 
2.11.0



More information about the Perl-maintainers mailing list