[llvm] [Release] Pass -n to gzip so the release tarball is reproducible (PR #216533)
Larry Meadows via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 15 21:00:20 PDT 2026
https://github.com/lfmeadow updated https://github.com/llvm/llvm-project/pull/216533
>From ece5675b65242fa13a16f05d7deb971c8e229f6b Mon Sep 17 00:00:00 2001
From: Larry Meadows <Lawrence.Meadows at amd.com>
Date: Sat, 15 Aug 2026 22:58:48 -0500
Subject: [PATCH] [Release] Pass -n to gzip so the release tarball is
reproducible
test-release.sh -use-gzip packages the release with
tar cf - $Package | gzip -9c > $BuildDir/$Package.tar.gz
and the MTIME field of the gzip header then records when the tarball was
packaged rather than anything about the release, so two runs over identical
input produce different bytes.
Whether that happens depends on the packaging host. GNU gzip stopped
stamping non-regular input in 1.10 (2018-12-29): "Compressed gzip output
no longer contains the current time as a timestamp when the input is not a
regular file." Every older gzip stamps the pipe above, which covers the
old distributions release tarballs tend to be built on for glibc
compatibility -- 1.5 on RHEL/CentOS 7, 1.6 on Ubuntu 18.04, 1.9 on RHEL 8.
pigz, which is often installed in place of gzip, stamps regardless of
version.
Pass -n at both call sites so the field is zeroed explicitly rather than
left to the host's gzip. It is a no-op on gzip 1.10 and later, and
Debian's lintian recommends the same flag when it reports such a file as
package-contains-timestamped-gzip.
Co-authored-by: Jonathan Luu <jonatluu at amd.com>
Co-authored-by: Cursor <cursoragent at cursor.com>
---
llvm/utils/release/test-release.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/release/test-release.sh b/llvm/utils/release/test-release.sh
index 20fbf83ce90a9..3c1d7ef4c2091 100755
--- a/llvm/utils/release/test-release.sh
+++ b/llvm/utils/release/test-release.sh
@@ -369,7 +369,7 @@ function build_with_cmake_cache() {
pushd $BuildDir/Release
mv $InstallDir/usr/local $Package
if [ "$use_gzip" = "yes" ]; then
- tar cf - $Package | gzip -9c > $BuildDir/$Package.tar.gz
+ tar cf - $Package | gzip -9c -n > $BuildDir/$Package.tar.gz
else
tar cf - $Package | xz -9ce -T $NumJobs > $BuildDir/$Package.tar.xz
fi
@@ -613,7 +613,7 @@ function package_release() {
cd $BuildDir/Phase3/Release
mv llvmCore-$Release-$RC.install/usr/local $Package
if [ "$use_gzip" = "yes" ]; then
- tar cf - $Package | gzip -9c > $BuildDir/$Package.tar.gz
+ tar cf - $Package | gzip -9c -n > $BuildDir/$Package.tar.gz
else
tar cf - $Package | xz -9ce -T $NumJobs > $BuildDir/$Package.tar.xz
fi
More information about the llvm-commits
mailing list