From 9bf0015a5d4f88441708256880cf4c7ea5ebce15 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Mon, 28 Jul 2025 10:45:09 -0500 Subject: [PATCH] run: copy artifacts with --sparse=never On macOS, files copied on a bind mounted volume can be corrupted if the original is sparse. In particular, this can happen for the rootfs image. Setting --sparse=never in the copy prevents this corruption. The rootfs.ext2 resulting from the current buildroot.yaml is not sparse, so this change will only noticeably affect custom configurations. Signed-off-by: Chris Reed --- shrinkwrap/utils/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py index 1c9d096..63ebd7d 100644 --- a/shrinkwrap/utils/config.py +++ b/shrinkwrap/utils/config.py @@ -1077,7 +1077,9 @@ def build_graph(configs, echo, nosync, force_sync): continue src = artifact['src'] dst = os.path.join(workspace.package, artifact['dst']) - a.append(f'cp -r {src} {dst}') + # Disallow sparse copies to prevent possible file corruption when the host + # volume is mounted into a docker container, particularly on macOS. + a.append(f'cp -r --sparse=never {src} {dst}') a.seal() graph[a] = [b] -- GitLab