Bug#973943: Test_compiler fails when locales are not available

2020-11-09 Thread Graham Inggs
On Tue, 10 Nov 2020 at 04:48, James McCoy  wrote:
> I don't think there's anything broken in your setup.  The default
> configuration allows the LC_* variables to pass thru to the build.

Thanks for confirming.  That does seem like a bug in sbuild to me.

> The attached patch seems to make everything work.

It works for me too. Successful build log:

https://people.debian.org/~ginggs/python3.9-default/vim_8.2.1913-1+build1_amd64-2020-11-10T06:54:53Z.build



Bug#973943: Test_compiler fails when locales are not available

2020-11-09 Thread James McCoy
Control: retitle -1 Test_compiler fails when locales are not available

On Mon, Nov 09, 2020 at 11:22:14PM +0200, Graham Inggs wrote:
> On Mon, 9 Nov 2020 at 21:25, James McCoy  wrote:
> > I mean I specifically set LANG (and LC_ALL in my local repo) to C.UTF-8
> > [1] when running Vim's tests and yet Perl still complains about the
> > unknown locale specified in the other environment variables.  That's
> > unexpected.
> 
> I saw that.  I mean you don't **need** to fix anything in the vim
> packaging, just so it can build in my (possibly broken) sbuild setup.

I don't think there's anything broken in your setup.  The default
configuration allows the LC_* variables to pass thru to the build.

If anything, I think Perl is mis-behaving here.  Either way, I'd perfer
the Vim build to be robust against this scenario.  The tests have enough
flakiness already without more help. :)

> However, if you give me a diff, or point me to a git branch, I'm happy
> to test.

The attached patch seems to make everything work.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB
diff --git a/debian/rules b/debian/rules
index bebc63c40..74af1b0c2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -224,8 +224,14 @@ build-vim-%:
 
 test-vim-%: VARIANT=vim-$*
 test-vim-%:
-# Ensure $TERM is set to a sane value for testing
-	[ $(MAKETEST) != "yes" ] || env LANG=C.UTF-8 TERM=xterm $(MAKE) -j1 -C src/$(VARIANT) test
+ifeq (yes,$(MAKETEST))
+# Sanitize LC_* env so they don't leak through to child processes and cause problems in build chroots (e.g., missing locales)
+# and set sane values for TERM/LC_ALL/LANG
+	for e in ADDRESS COLLATE CTYPE IDENTIFICATION MEASUREMENT MESSAGES MONETARY NAME NUMERIC PAPER TELEPHONE TIME; do \
+	  unset LC_$${e}; \
+	done; \
+	env TERM=xterm LC_ALL=C.UTF-8 LANG=C.UTF-8 $(MAKE) -j1 -C src/$(VARIANT) test
+endif
 
 override_dh_auto_install-arch: