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

Bug#1011478: scsitools: reproducible-builds: embedded build paths in various binaries



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

The build path is embedded in various binaries:

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

  /sbin/scsi-spin

  /build/1st/scsitools-0.12/debian/scsi-spin.c:290
  vs.
  /build/2/scsitools-0.12/2nd/debian/scsi-spin.c:290

The attached patch fixes this by setting -ffile-prefix-map in CFLAGS,
and explicitly passing CFLAGS to make in debian/rules. The
-ffile-prefix-map compiler flag is used to avoid embedding the absolute
path in compiled files.

Alternately, switching to use the default CFLAGS from dpkg-buildflags
(possibly through using a newer debhelper compat version) also would
include -ffile-prefix-map by default.


With this patch applied, scsitools should build reproducibly on
tests.reproducible-builds.org!


live well,
  vagrant
From 271eb71f9c87d7bab1080b5db52f3468f7acec52 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Mon, 23 May 2022 19:19:28 +0000
Subject: [PATCH] debian/rules: Pass -ffile-prefix-map via CFLAGS.

---
 debian/rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/rules b/debian/rules
index 2adc025..32ba7b7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,7 +2,7 @@
 # Derived from debhelper/dh_make example, and Cristoph Lameter's file. -joy
 
 #export DH_VERBOSE=1
-CFLAGS = -g -O2 -Wall -fsigned-char
+CFLAGS = -g -O2 -Wall -fsigned-char -ffile-prefix-map=$(CURDIR)=.
 
 #architecture := $(shell dpkg-architecture -qDEB_HOST_ARCH)
 p = scsitools
@@ -11,7 +11,7 @@ p = scsitools
 	dh $@
 
 override_dh_auto_build:
-	cd scsiinfo && $(MAKE) KERNEL_INCLUDES="-fsigned-char" LDFLAGS=
+	cd scsiinfo && $(MAKE) KERNEL_INCLUDES="-fsigned-char" LDFLAGS= CFLAGS="$(CFLAGS)"
 	cd scsidev && CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
           --mandir='${prefix}'/share/man && $(MAKE)
 	cd sraw && gcc $(CFLAGS) -o sraw srawread.c
-- 
2.36.1

Attachment: signature.asc
Description: PGP signature


Reply to: