public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Thelen <gthelen@google.com>
To: kvm@vger.kernel.org
Cc: Greg Thelen <gthelen@google.com>
Subject: [kvm-unit-tests PATCH] avoid encoding mtime in standalone scripts
Date: Mon,  5 Dec 2022 08:28:40 -0800	[thread overview]
Message-ID: <20221205162840.535675-1-gthelen@google.com> (raw)

Reproducible builds aid in caching builds and tests. Ideally rebuilding
the same source produces identical outputs.

The standalone kvm test scripts contain base64 encoded gzip compressed
test binaries. Compression and encoding is done with
"gzip -c FILE | base64" which stores FILE's name and mtime in the
compressed output.

Binaries are expanded with
  base64 -d << 'BIN_EOF' | zcat > OUTPUT
This expansion pipeline ignores the gzip stored name and mtime.

Use "gzip -n" to avoid saving mtime in the output. This makes the
standalone test scripts reproducible. Their contents are the same
regardless of when they are built.

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 scripts/mkstandalone.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 86c7e5498246..1e6d308b43f7 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -16,7 +16,8 @@ temp_file ()
 	echo "cleanup=\"\$$var \$cleanup\""
 	echo "base64 -d << 'BIN_EOF' | zcat > \$$var || exit 2"
 
-	gzip -c "$file" | base64
+	# For reproductible builds avoid saving $file mtime with -n
+	gzip -nc "$file" | base64
 
 	echo "BIN_EOF"
 	echo "chmod +x \$$var"
-- 
2.39.0.rc0.267.gcb52ba06e7-goog


             reply	other threads:[~2022-12-05 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 16:28 Greg Thelen [this message]
2022-12-06  6:14 ` [kvm-unit-tests PATCH] avoid encoding mtime in standalone scripts Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221205162840.535675-1-gthelen@google.com \
    --to=gthelen@google.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox