NetBSD Problem Report #57925

From www@netbsd.org  Sun Feb 11 00:40:50 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 CF6D21A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 11 Feb 2024 00:40:50 +0000 (UTC)
Message-Id: <20240211004049.43A981A9239@mollari.NetBSD.org>
Date: Sun, 11 Feb 2024 00:40:49 +0000 (UTC)
From: jbglaw@lug-owl.de
Reply-To: jbglaw@lug-owl.de
To: gnats-bugs@NetBSD.org
Subject: [RB] mkimage: Honor $MKREPRO_TIMESTAMP
X-Send-Pr-Version: www-1.0

>Number:         57925
>Category:       misc
>Synopsis:       [RB] mkimage: Honor $MKREPRO_TIMESTAMP
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 11 00:45:00 +0000 2024
>Last-Modified:  Sun Feb 11 17:30:02 +0000 2024
>Originator:     Jan-Benedict Glaw
>Release:        current
>Organization:
>Environment:
>Description:
Several mach/arch tuples use ./distrib/utils/embedded/mkimage, which allows for build timestamps to sneak into the generated image.
>How-To-Repeat:
Build twice, compare results, eg. for riscv/riscv32.
>Fix:
The following patch will fix most of the issues. I still see a last-written or umount timestamp, still searching for that...


diff --git a/distrib/utils/embedded/mkimage b/distrib/utils/embedded/mkimage
index 737d057a61fa..03392b20c2c1 100755
--- a/distrib/utils/embedded/mkimage
+++ b/distrib/utils/embedded/mkimage
@@ -245,16 +245,24 @@ if [ -n "${msdosid}" ]; then
        11|12)  fat_opt=",fat_type=32";;
        *)      fat_opt=;;
        esac
+       if [ -n ${MKREPRO_TIMESTAMP} ]; then
+               makefs_opt="-T ${MKREPRO_TIMESTAMP}"
+               fat_opt="${fat_opt},volume_id=$((${MKREPRO_TIMESTAMP} & 0xffff))"
+       fi
+
        ${MAKEFS} -N ${release}/etc -t msdos \
-           -o "volume_label=NETBSD${fat_opt}" \
+           -o "volume_label=NETBSD${fat_opt}" ${makefs_opt} \
            -O $((${init} / 2))m -s $((${boot} / 2))m \
            ${image} ${mnt}/boot
 fi

 if [ -z "${bootonly}" ]; then
        echo ${bar} Populating ffs filesystem ${bar}
+       if [ -n ${MKREPRO_TIMESTAMP} ]; then
+               makefs_opt="-T ${MKREPRO_TIMESTAMP}"
+       fi
        ${MAKEFS} -rx ${endian} -N ${release}/etc -t ffs \
-           -O ${ffsoffset} \
+           -O ${ffsoffset} ${makefs_opt} \
            -o d=4096,f=8192,b=65536 -b $((${extra}))m \
            -F "$tmp/selected_sets" ${image} "${release}" "${mnt}"
 fi
@@ -276,6 +284,9 @@ if $gpt; then
        if $gpt_hybrid; then
                gpt_flags="-H"
        fi
+       if [ -n ${MKREPRO_TIMESTAMP} ]; then
+               gpt_flags="$gpt_flags -T ${MKREPRO_TIMESTAMP}"
+       fi
        initsecs=$((${init} * 1024))
        bootsecs=$((${boot} * 1024))
        ffsstart="$(getsectors ${ffsoffset})"
@@ -328,7 +339,7 @@ fi
 if $compress; then
        echo ${bar} Compressing image ${bar}
        rm -f "${image}.gz"
-       ${GZIP_CMD} -9 ${image}
+       ${GZIP_CMD} -n -9 ${image}
        image="${image}.gz"
 fi


>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57925 CVS commit: src/distrib/utils/embedded
Date: Sun, 11 Feb 2024 12:29:50 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Feb 11 17:29:50 UTC 2024

 Modified Files:
 	src/distrib/utils/embedded: mkimage

 Log Message:
 PR/57925: Jan-Benedict Glaw: Honor $MKREPRO_TIMESTAMP, don't embed name and
 stamp in gzip.


 To generate a diff of this commit:
 cvs rdiff -u -r1.79 -r1.80 src/distrib/utils/embedded/mkimage

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(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.