Source: openssl
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

The compiler flags usually contain the build path on Debian package
builds, and openssl embeds the compiler flags used in various binaries:

  
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/armhf/diffoscope-results/openssl.html

  /usr/lib/libcrypto.so.1.1

  
compiler:·gcc·-fPIC...-ffile-prefix-map=/build/1st/openssl-1.1.1n=.·-fstack-...
  vs.
  
compiler:·gcc·-fPIC...-ffile-prefix-map=/build/2/openssl-1.1.1n/2nd=.·-fstack-...


The attached patch fixes this by adjusting util/mkbuildinf.pl to strip
the buildpath out and replace it with the with the placeholder string
"BUILDPATH".


Unfortunately, there are other outstanding issues affecting the
reproducibility of openssl, but applying this patch should reduce the
differences, making it easier to debug the remaining issues.


Thanks for maintaining openssl!


live well,
  vagrant
From 04cb9131bd4a7193a94a70fcfcf8132bff2d0fd8 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Wed, 20 Apr 2022 22:26:55 +0000
Subject: [PATCH] util/mkbuildinf.pl: Replace build path in cflags with a
 placeholder string.

The compiler flags are embedded in various binary files, which on
debian systems typically includes -ffile-prefix-map or
-fdebug-prefix-map which contains the full build path.

https://tests.reproducible-builds.org/debian/issues/unstable/records_build_flags_issue.html
---
 util/mkbuildinf.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/util/mkbuildinf.pl b/util/mkbuildinf.pl
index 1c273872be..2231700f95 100755
--- a/util/mkbuildinf.pl
+++ b/util/mkbuildinf.pl
@@ -8,8 +8,15 @@
 
 use strict;
 use warnings;
+use Cwd;
+use File::Basename;
 
 my ($cflags, $platform) = @ARGV;
+
+my $abs_srcdir = dirname(dirname(Cwd::realpath($0)));
+# replace full path to build directory with string BUILDDIR, passed
+# via -ffile-prefix-map, -fdebug-prefix-map or -fmacro-prefix-map
+$cflags =~ s/prefix-map=$abs_srcdir=/prefix-map=BUILDDIR=/ ;
 $cflags = "compiler: $cflags";
 
 my $date = gmtime($ENV{'SOURCE_DATE_EPOCH'} || time()) . " UTC";
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature

Reply via email to