[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#977793: nis: reproducible builds: variable build path triggers Build ID variations



Source: nis
Severity: normal
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

Various binaries shipped in nis are build differently when the build
path varies:

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

  /usr/bin/ypcat
  GNU··0x00000014»  NT_GNU_BUILD_ID·(unique·build·ID·bitstring)» Build·ID:·dedd8715faeef72ca4c5130f43d08f8df595b39a
  vs. 
  GNU 0x00000014»  NT_GNU_BUILD_ID·(unique·build·ID·bitstring)»  Build·ID:·5dba43813c061ce956ac0741ae4bb981fc1eaa4e

The attached patch fixes this by adding -ffile-prefix-map to CFLAGS.


live well,
  vagrant
From a0a9ef87562f56000e30749d535c948b48de4cd9 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Sun, 20 Dec 2020 23:30:56 +0000
Subject: [PATCH] debian/rules: Add -ffile-prefix-map to CFLAGS.

This is used to strip the build path from the resulting binaries,
fixing variable Build IDs in the binaries.

https://tests.reproducible-builds.org/debian/issues/build_id_differences_only_issue.html
---
 debian/rules | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/debian/rules b/debian/rules
index abc714e..99dfcc1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,14 +17,16 @@ include /usr/share/dpkg/architecture.mk
 BUILD_DATE=$(shell dpkg-parsechangelog --show-field Date)
 
 ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-        CFLAGS = "-O2 -Wall -g"
+        CFLAGS = -O2 -Wall -g
 else
-        CFLAGS = "-O0 -Wall -g"
+        CFLAGS = -O0 -Wall -g
 endif
 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 #        INSTALL_PROGRAM += -s
 #endif
 
+# Avoid embedding build paths in binaries for reproducible builds
+CFLAGS += -ffile-prefix-map=$(CURDIR)=.
 
 define checkdir
 	test -f $(YPBIND)/README
@@ -36,13 +38,13 @@ build:
 # Builds the binary package.
 	dh_autoreconf
 	-(cd $(YPTOOLS) && [ ! -f config.status ] && \
-		CFLAGS=$(CFLAGS) ./configure \
+		CFLAGS="$(CFLAGS)" ./configure \
 		--prefix=/usr --mandir=/usr/share/man \
 		--build=$(DEB_BUILD_GNU_TYPE) \
 		--host=$(DEB_HOST_GNU_TYPE) )
 	(cd $(YPTOOLS) && make)
 	-(cd $(YPBIND) && [ ! -f config.status ] && \
-		CFLAGS=$(CFLAGS) ./configure \
+		CFLAGS="$(CFLAGS)" ./configure \
 		--prefix=/usr --mandir=/usr/share/man \
 		--sysconfdir=/etc --libexecdir=/usr/lib/yp \
 		--disable-dbus-nm \
@@ -51,7 +53,7 @@ build:
 	(cd $(YPBIND) && make )
 	rm -f $(YPSERV)/sedscript
 	-(cd $(YPSERV) && [ ! -f config.status ] && \
-		AWK=/usr/bin/awk CFLAGS=$(CFLAGS) ./configure \
+		AWK=/usr/bin/awk CFLAGS="$(CFLAGS)" ./configure \
 		BASH=/bin/bash \
 		--prefix=/usr --mandir=/usr/share/man \
 		--sysconfdir=/etc \
-- 
2.29.2

Attachment: signature.asc
Description: PGP signature


Reply to: