Debian Bug report logs - #990862
infinipath-psm: reproducible builds: Embedded timestamps in libpsm_infinipath.so

Package: src:infinipath-psm; Maintainer for src:infinipath-psm is Debian HPC Team <debian-hpc@lists.debian.org>;

Reported by: Vagrant Cascadian <vagrant@reproducible-builds.org>

Date: Fri, 9 Jul 2021 15:30:02 UTC

Severity: normal

Tags: patch

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, reproducible-bugs@lists.alioth.debian.org, Debian HPC Team <debian-hpc@lists.debian.org>:
Bug#990862; Package src:infinipath-psm. (Fri, 09 Jul 2021 15:30:04 GMT) (full text, mbox, link).


Acknowledgement sent to Vagrant Cascadian <vagrant@reproducible-builds.org>:
New Bug report received and forwarded. Copy sent to reproducible-bugs@lists.alioth.debian.org, Debian HPC Team <debian-hpc@lists.debian.org>. (Fri, 09 Jul 2021 15:30:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Vagrant Cascadian <vagrant@reproducible-builds.org>
To: submit@bugs.debian.org
Subject: infinipath-psm: reproducible builds: Embedded timestamps in libpsm_infinipath.so
Date: Fri, 09 Jul 2021 08:27:50 -0700
[Message part 1 (text/plain, inline)]
Source: infinipath-psm
Severity: normal
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

The build timestamp is embedded in libpsm_infinipath.so.*:

  https://tests.reproducible-builds.org/debian/rb-pkg/bullseye/amd64/diffoscope-results/infinipath-psm.html

  ./usr/lib/libpsm1/libpsm_infinipath.so.1.16

  $Date:·2022-07-17·21:34·InfiniPath·$
  vs.
  $Date:·2021-06-15·17:13·InfiniPath·$

The attached patch fixes this by changing buildflags.mak to set a
BUILD_DATE variable, which uses SOURCE_DATE_EPOCH for the current value
if set, falling back to the current time/date; two Makefiles are also
adjusted to use BUILD_DATE instead of calling "date" directly.

  https://reproducible-builds.org/docs/source-date-epoch/


With this patch applied, infinipath-psm should be reproducible on
tests.reproducible-builds.org in the testing (currently bullseye) suite,
where build paths are not varied. In the unstable/experimental suites,
varied build paths trigger other issues which could use further
exploration.


Thanks for maintaining infinipath-psm!


live well,
  vagrant
[0001-Use-the-build-date-from-SOURCE_DATE_EPOCH-if-set-fal.patch (text/x-diff, inline)]
From d9ce27e80d5b0d7028ac20136017147f49a780f4 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Fri, 9 Jul 2021 15:13:24 +0000
Subject: [PATCH] Use the build date from SOURCE_DATE_EPOCH if set, falling
 back to current time.

https://reproducible-builds.org/docs/source-date-epoch/
---
 Makefile       | 2 +-
 buildflags.mak | 8 ++++++++
 ipath/Makefile | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d79c4bd..64d6f6b 100644
--- a/Makefile
+++ b/Makefile
@@ -270,7 +270,7 @@ ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR}
 # file around.  Generate it such that the ident command can find it
 # and strings -a | grep InfiniPath does a reasonable job as well.
 ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
-	date +'char psmi_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > ${lib_build_dir}/_revision.c
+	printf 'char psmi_infinipath_revision[] ="$$""Date: %s ${rpm_extra_description} InfiniPath $$";\n' "$(BUILD_DATE)" > ${lib_build_dir}/_revision.c
 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
 	$(CC) $(LDFLAGS) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared -Wl,--unique='*fastpath*' \
 		${${TARGLIB}-objs} _revision.o -L$(build_dir)/ipath $(LDLIBS)
diff --git a/buildflags.mak b/buildflags.mak
index 34fdf1c..3e25649 100644
--- a/buildflags.mak
+++ b/buildflags.mak
@@ -96,3 +96,11 @@ endif
 CFLAGS += $(BASECFLAGS) $(if $(filter $(CC),gcc),-Wno-strict-aliasing) \
 	$(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND)
 
+# Use SOURCE_DATE_EPOCH for build date, falling back to current time
+# https://reproducible-builds.org/docs/source-date-epoch/
+DATE_FMT="+'%F %R'"
+ifdef FIXME_SOURCE_DATE_EPOCH
+    BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
+else
+    BUILD_DATE ?= $(shell date "$(DATE_FMT)")
+endif
diff --git a/ipath/Makefile b/ipath/Makefile
index 8c2cc6e..e627b3d 100644
--- a/ipath/Makefile
+++ b/ipath/Makefile
@@ -70,7 +70,7 @@ ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR}
 # file around.  Generate it such that the ident command can find it
 # and strings -a | grep InfiniPath does a reasonable job as well.
 ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
-	date +'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > _revision.c
+	printf 'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %s ${rpm_extra_description}InfiniPath $$";\n' "$(BUILD_DATE)" > _revision.c
 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
 	$(CC) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared \
 		-Wl,--unique='*fastpath*' \
-- 
2.32.0

[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian HPC Team <debian-hpc@lists.debian.org>:
Bug#990862; Package src:infinipath-psm. (Fri, 09 Jul 2021 16:00:03 GMT) (full text, mbox, link).


Acknowledgement sent to Vagrant Cascadian <vagrant@reproducible-builds.org>:
Extra info received and forwarded to list. Copy sent to Debian HPC Team <debian-hpc@lists.debian.org>. (Fri, 09 Jul 2021 16:00:03 GMT) (full text, mbox, link).


Message #10 received at 990862@bugs.debian.org (full text, mbox, reply):

From: Vagrant Cascadian <vagrant@reproducible-builds.org>
To: 990862@bugs.debian.org
Subject: Re: infinipath-psm: reproducible builds: Embedded timestamps in libpsm_infinipath.so
Date: Fri, 09 Jul 2021 08:56:56 -0700
[Message part 1 (text/plain, inline)]
On 2021-07-09, Vagrant Cascadian wrote:
> diff --git a/buildflags.mak b/buildflags.mak
> index 34fdf1c..3e25649 100644
> --- a/buildflags.mak
> +++ b/buildflags.mak
> @@ -96,3 +96,11 @@ endif
>  CFLAGS += $(BASECFLAGS) $(if $(filter $(CC),gcc),-Wno-strict-aliasing) \
>  	$(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND)
>  
> +# Use SOURCE_DATE_EPOCH for build date, falling back to current time
> +# https://reproducible-builds.org/docs/source-date-epoch/
> +DATE_FMT="+'%F %R'"
> +ifdef FIXME_SOURCE_DATE_EPOCH

^^^ OopS! that was my debugging attempt to make sure it works when
SOURCE_DATE_EPOCH is not set.

It *should* be:

  ifdef SOURCE_DATE_EPOCH

> +    BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
> +else
> +    BUILD_DATE ?= $(shell date "$(DATE_FMT)")
> +endif

Will send updated patch...


live well,
  vagrant
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian HPC Team <debian-hpc@lists.debian.org>:
Bug#990862; Package src:infinipath-psm. (Sat, 10 Jul 2021 02:06:03 GMT) (full text, mbox, link).


Acknowledgement sent to Vagrant Cascadian <vagrant@reproducible-builds.org>:
Extra info received and forwarded to list. Copy sent to Debian HPC Team <debian-hpc@lists.debian.org>. (Sat, 10 Jul 2021 02:06:03 GMT) (full text, mbox, link).


Message #15 received at 990862@bugs.debian.org (full text, mbox, reply):

From: Vagrant Cascadian <vagrant@reproducible-builds.org>
To: 990862@bugs.debian.org
Subject: Re: infinipath-psm: reproducible builds: Embedded timestamps in libpsm_infinipath.so
Date: Fri, 09 Jul 2021 19:03:39 -0700
[Message part 1 (text/plain, inline)]
On 2021-07-09, Vagrant Cascadian wrote:
> On 2021-07-09, Vagrant Cascadian wrote:
>> diff --git a/buildflags.mak b/buildflags.mak
>> index 34fdf1c..3e25649 100644
>> --- a/buildflags.mak
>> +++ b/buildflags.mak
>> @@ -96,3 +96,11 @@ endif
>>  CFLAGS += $(BASECFLAGS) $(if $(filter $(CC),gcc),-Wno-strict-aliasing) \
>>  	$(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND)
>>  
>> +# Use SOURCE_DATE_EPOCH for build date, falling back to current time
>> +# https://reproducible-builds.org/docs/source-date-epoch/
>> +DATE_FMT="+'%F %R'"
>> +ifdef FIXME_SOURCE_DATE_EPOCH
>
> ^^^ OopS! that was my debugging attempt to make sure it works when
> SOURCE_DATE_EPOCH is not set.
>
> It *should* be:
>
>   ifdef SOURCE_DATE_EPOCH
>
>> +    BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
>> +else
>> +    BUILD_DATE ?= $(shell date "$(DATE_FMT)")
>> +endif
>
> Will send updated patch...

Corrected patch attached. Sorry for the mixup!


live well,
  vagrant
[0001-Use-the-build-date-from-SOURCE_DATE_EPOCH-if-set-fal.patch (text/x-diff, inline)]
From 88b66063c5f02ba48f2fc9cfa2ae6cc42c950cc8 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Fri, 9 Jul 2021 15:13:24 +0000
Subject: [PATCH] Use the build date from SOURCE_DATE_EPOCH if set, falling
 back to current time.

https://reproducible-builds.org/docs/source-date-epoch/
---
 Makefile       | 2 +-
 buildflags.mak | 8 ++++++++
 ipath/Makefile | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d79c4bd..64d6f6b 100644
--- a/Makefile
+++ b/Makefile
@@ -270,7 +270,7 @@ ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR}
 # file around.  Generate it such that the ident command can find it
 # and strings -a | grep InfiniPath does a reasonable job as well.
 ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
-	date +'char psmi_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > ${lib_build_dir}/_revision.c
+	printf 'char psmi_infinipath_revision[] ="$$""Date: %s ${rpm_extra_description} InfiniPath $$";\n' "$(BUILD_DATE)" > ${lib_build_dir}/_revision.c
 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
 	$(CC) $(LDFLAGS) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared -Wl,--unique='*fastpath*' \
 		${${TARGLIB}-objs} _revision.o -L$(build_dir)/ipath $(LDLIBS)
diff --git a/buildflags.mak b/buildflags.mak
index 34fdf1c..be40c40 100644
--- a/buildflags.mak
+++ b/buildflags.mak
@@ -96,3 +96,11 @@ endif
 CFLAGS += $(BASECFLAGS) $(if $(filter $(CC),gcc),-Wno-strict-aliasing) \
 	$(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND)
 
+# Use SOURCE_DATE_EPOCH for build date, falling back to current time
+# https://reproducible-builds.org/docs/source-date-epoch/
+DATE_FMT="+'%F %R'"
+ifdef SOURCE_DATE_EPOCH
+    BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
+else
+    BUILD_DATE ?= $(shell date "$(DATE_FMT)")
+endif
diff --git a/ipath/Makefile b/ipath/Makefile
index 8c2cc6e..e627b3d 100644
--- a/ipath/Makefile
+++ b/ipath/Makefile
@@ -70,7 +70,7 @@ ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR}
 # file around.  Generate it such that the ident command can find it
 # and strings -a | grep InfiniPath does a reasonable job as well.
 ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs}
-	date +'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > _revision.c
+	printf 'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %s ${rpm_extra_description}InfiniPath $$";\n' "$(BUILD_DATE)" > _revision.c
 	$(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o
 	$(CC) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared \
 		-Wl,--unique='*fastpath*' \
-- 
2.32.0

[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed May 17 12:27:19 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.