arsv/perl-cross

Modules lists aren't generated deterministically/reproducibly

rpurdie opened this issue · 0 comments

We (the Yocto Project) are running into issues where Makefile.config and config.sh are different depending on the host or in fact the order of the modules files on disk. This leads to differences in ordering of the extensions=, known_extensions=, nonxs_ext= and dynamic_ext= lines.

One way of fixing it would be this change:

Index: perl-5.30.1/cnf/configure_mods.sh
===================================================================
--- perl-5.30.1.orig/cnf/configure_mods.sh
+++ perl-5.30.1/cnf/configure_mods.sh
@@ -82,7 +82,7 @@ extonlyif() {
 }
 
 definetrimspaces() {
-	v=`echo "$2" | sed -r -e 's/\s+/ /g' -e 's/^\s+//' -e 's/\s+$//'`
+	v=`echo "$2" | sed -r -e 's/\s+/ /g' -e 's/^\s+//' -e 's/\s+$//' | xargs -n1 | LANG=C sort | xargs`
 	define $1 "$v"
 }

the LANG=C being to ensure the sort order is deterministic and not dependent on the host locale.