Source: pbuilder
Version: 0.231
Severity: important
Affects: curl trurl
Tags: patch

Hi,

Charles from the Debian curl team noticed that curl and trurl have been
failing to build in the reproducible-builds environment:

  https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/curl.html

He also found that the problem happens because the build environment
doesn't seem to have UTF-8 support, which is required by the upstream
testsuite of both packages.  The $LANG environment variable is set to
"C", as can be checked in the logs:

  https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/curl.html

--8<---------------cut here---------------start------------->8---
I: user script /srv/workspace/pbuilder/3967986/tmp/hooks/D02_print_environment 
starting
I: set
...
  LANG='C'
  LANGUAGE='en_US:en'
  LC_ALL='C'
...
--8<---------------cut here---------------end--------------->8---

This is strange, because the same build succeeds when done locally (with
sbuild) or in the archive (which also uses sbuild).  So we joined
efforts this afternoon and tracked down the bug to pbuild, which happens
to be used in the reproducible-builds setup.

Long story short, the problem comes from this excerpt found in the
pbuilder-modules script:

  
https://salsa.debian.org/pbuilder-team/pbuilder/-/blob/master/pbuilder-modules?ref_type=heads#L1180-1183

Interestingly, these lines were added 22 years ago by this commit,
according to git-blame:

  
https://salsa.debian.org/pbuilder-team/pbuilder/-/commit/296a5a338a397c6cf8c77a813dc29bd1b7ce8b19

They interfere with the way reproducible-builds sets $LANG for builds:

  
https://salsa.debian.org/qa/jenkins.debian.net/-/blob/master/bin/reproducible_build.sh?ref_type=heads#L627-638

and end up overriding the variable.

It's also important to note that this problem is not specific to
reproducible-builds; the FTBFS can be easily reproduced by just trying
to build curl or trurl locally, without any changes.  And as explained
above, setting $LANG via --configfile doesn't work.

The patch below fixes the problem, but I'm not sure it's the right
approach when it comes to $LC_ALL, given its idiosyncrasies.  It may be
better to reassess whether setting these variables at the end of the
script is still the right thing to do.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/

diff --git a/pbuilder-modules b/pbuilder-modules
index aca876de..47807f84 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -1179,5 +1179,5 @@ function executehooks () {
 
 #Setting environmental variables that are really required:
 #required for some packages to install...
-export LANG=C
-export LC_ALL=C
+export LANG="${LANG:-C}"
+export LC_ALL="${LC_ALL:-C}"

Attachment: signature.asc
Description: PGP signature

Reply via email to