git: 4317d0aa8c21 - stable/14 - release: avoid sparse-file handling for container image layers

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Tue, 15 Apr 2025 22:10:33 UTC
The branch stable/14 has been updated by dch:

URL: https://cgit.FreeBSD.org/src/commit/?id=4317d0aa8c21f19764dabcd0bea3d1d92fea19c3

commit 4317d0aa8c21f19764dabcd0bea3d1d92fea19c3
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2025-04-15 22:00:50 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2025-04-15 22:09:29 +0000

    release: avoid sparse-file handling for container image layers
    
    This improves compatiblity with Podman. See
    https://github.com/containers/podman/issues/25270 for details.
    
    Differential Revision:  https://reviews.freebsd.org/D49821
    
    (cherry picked from commit 3a79ca65531adf9fc8799b39407fe4d1b51906f6)
---
 release/scripts/make-oci-image.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/release/scripts/make-oci-image.sh b/release/scripts/make-oci-image.sh
index 0fd64602b403..cc599c76bd51 100644
--- a/release/scripts/make-oci-image.sh
+++ b/release/scripts/make-oci-image.sh
@@ -95,8 +95,13 @@ commit_container() {
 	local image=$1; shift
 	local output=$1; shift
 
-	# Note: the diff_id (needed for image config) is the hash of the uncompressed tar
-	tar -C ${workdir}/rootfs --strip-components 1 -cf ${workdir}/rootfs.tar .
+	# Note: the diff_id (needed for image config) is the hash of the
+	# uncompressed tar.
+	#
+	# For compatibility with Podman, we must disable sparse-file
+	# handling. See https://github.com/containers/podman/issues/25270 for
+	# more details.
+	tar -C ${workdir}/rootfs --strip-components 1 --no-read-sparse -cf ${workdir}/rootfs.tar .
 	local diff_id=$(sha256 -q < ${workdir}/rootfs.tar)
 	gzip -f ${workdir}/rootfs.tar
 	local create_time=$(date -u +%Y-%m-%dT%TZ)