NetBSD Problem Report #57909
From www@netbsd.org Thu Feb 8 15:09:28 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 7C1141A9238
for <gnats-bugs@gnats.NetBSD.org>; Thu, 8 Feb 2024 15:09:28 +0000 (UTC)
Message-Id: <20240208150927.97D9E1A9239@mollari.NetBSD.org>
Date: Thu, 8 Feb 2024 15:09:27 +0000 (UTC)
From: jbglaw@lug-owl.de
Reply-To: jbglaw@lug-owl.de
To: gnats-bugs@NetBSD.org
Subject: [RB] hp300/m68k mkboot: Don't include (build) timestamp when doing a reproducible build
X-Send-Pr-Version: www-1.0
>Number: 57909
>Category: misc
>Synopsis: [RB] hp300/m68k mkboot: Don't include (build) timestamp when doing a reproducible build
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: misc-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 08 15:10:00 +0000 2024
>Last-Modified: Thu Feb 08 18:15:01 +0000 2024
>Originator: Jan-Benedict Glaw
>Release: current
>Organization:
>Environment:
Linux lili 5.16.0-4-amd64 #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08) x86_64 GNU/Linux
>Description:
I'm running lots of CI builds and started to actually also test reproducibility. For hp300/m68k, I noticed that build artifacts contain a timestamp.
>How-To-Repeat:
Build twice for hp300/m68k with `build.sh [...] -P` and compare artifacts.
>Fix:
diff --git a/sys/arch/hp300/stand/Makefile.buildboot b/sys/arch/hp300/stand/Makefile.buildboot
index 1f528d5d3f96..2ff61444b7e4 100644
--- a/sys/arch/hp300/stand/Makefile.buildboot
+++ b/sys/arch/hp300/stand/Makefile.buildboot
@@ -29,9 +29,13 @@ LIBC=
LIBCRTBEGIN=
LIBCRTEND=
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+HP300MKBOOT_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}"
+.endif
+
${PROG}: ${PROGAOUT}
${OBJCOPY} --output-target=binary ${PROGAOUT} ${PROGAOUT}.bin
- ${TOOL_HP300MKBOOT} -l 0x${RELOC} ${PROGAOUT}.bin ${PROG}
+ ${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGAOUT}.bin ${PROG}
rm -f ${PROGAOUT}.bin
.include "${S}/conf/newvers_stand.mk"
diff --git a/sys/arch/hp300/stand/mkboot/mkboot.c b/sys/arch/hp300/stand/mkboot/mkboot.c
index 5f7bd7fecc1f..914d094c0f49 100644
--- a/sys/arch/hp300/stand/mkboot/mkboot.c
+++ b/sys/arch/hp300/stand/mkboot/mkboot.c
@@ -83,6 +83,7 @@ int loadpoint;
struct load ld;
struct lifvol lifv;
struct lifdir lifd[LIF_NUMDIR];
+time_t repro_epoch = 0;
int main(int, char **);
void bcddate(char *, char *);
@@ -127,6 +128,15 @@ main(int argc, char **argv)
argv++;
argc--;
}
+ if (!strcmp(argv[0], "-t")) {
+ argv++;
+ argc--;
+ if (argc == 0)
+ usage();
+ repro_epoch = atol(argv[0]);
+ argv++;
+ argc--;
+ }
if (!lpflag || argc == 0)
usage();
n1 = argv[0];
@@ -251,7 +261,7 @@ usage(void)
{
fprintf(stderr,
- "usage: mkboot -l loadpoint prog1 [ prog2 ] outfile\n");
+ "usage: mkboot -l loadpoint [-t epoch] prog1 [ prog2 ] outfile\n");
exit(1);
}
@@ -284,8 +294,12 @@ bcddate(char *name, char *toc)
struct stat statb;
struct tm *tm;
- stat(name, &statb);
- tm = localtime(&statb.st_ctime);
+ if (repro_epoch)
+ tm = gmtime(&repro_epoch);
+ else {
+ stat(name, &statb);
+ tm = localtime(&statb.st_ctime);
+ }
*toc = ((tm->tm_mon+1) / 10) << 4;
*toc++ |= (tm->tm_mon+1) % 10;
*toc = (tm->tm_mday / 10) << 4;
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57909 CVS commit: src/sys/arch/hp300/stand
Date: Thu, 8 Feb 2024 13:10:34 -0500
Module Name: src
Committed By: christos
Date: Thu Feb 8 18:10:34 UTC 2024
Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/mkboot: mkboot.c
Log Message:
PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/mkboot.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.