Source: bitcoin
Version: 0.10.2-3
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: locale
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds"€ effort [1], we have noticed
that bitcoin could not be built reproducibly.
A file list is sorted differently depending on the locale.

The attached patch fixes this by setting to LC_ALL to C before sorting.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds

diff --git a/debian/patches/1008_reproducible_build.patch b/debian/patches/1008_reproducible_build.patch
new file mode 100644
index 0000000..e1efccc
--- /dev/null
+++ b/debian/patches/1008_reproducible_build.patch
@@ -0,0 +1,20 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Locale-independent sorting of file list
+ sort behaves differently depending on the configured locale,
+ which results in an unreproducible build.
+ By setting LC_ALL to C before sorting, the file list will
+ always be the same.
+
+Index: bitcoin-0.10.2/src/leveldb/build_detect_platform
+===================================================================
+--- bitcoin-0.10.2.orig/src/leveldb/build_detect_platform
++++ bitcoin-0.10.2/src/leveldb/build_detect_platform
+@@ -188,7 +188,7 @@ set -f # temporarily disable globbing so
+ PRUNE_TEST="-name *test*.cc -prune"
+ PRUNE_BENCH="-name *_bench.cc -prune"
+ PRUNE_TOOL="-name leveldb_main.cc -prune"
+-PORTABLE_FILES=`find $DIRS $PRUNE_TEST -o $PRUNE_BENCH -o $PRUNE_TOOL -o -name '*.cc' -print | sort | sed "s,^$PREFIX/,," | tr "\n" " "`
++PORTABLE_FILES=`find $DIRS $PRUNE_TEST -o $PRUNE_BENCH -o $PRUNE_TOOL -o -name '*.cc' -print | LC_ALL=C sort | sed "s,^$PREFIX/,," | tr "\n" " "`
+ 
+ set +f # re-enable globbing
+ 
diff --git a/debian/patches/series b/debian/patches/series
index feeb0e2..5ace2d5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,4 +3,5 @@
 #1005_use_system_leveldb.patch
 1006_libmemenv_kfrebsd.patch
 1007_libmemenv_hurd.patch
+1008_reproducible_build.patch
 2002_libmemenv_debian-ports.patch

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to