From b42e7f05e3e4f34ca4ddac8d0cea11b7e07c6de5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 8 Oct 2021 12:40:13 +0200 Subject: [PATCH] mkosi: when done, dig out all holes (unless we compress anyway) We likely have some NUL bytes in the image, let's explicitly seek them out and punch holes into them. --- mkosi/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkosi/__init__.py b/mkosi/__init__.py index fb30e7bef..9dec8eaa4 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3942,11 +3942,16 @@ def extract_unified_kernel( def compress_output( args: CommandLineArguments, data: Optional[BinaryIO], suffix: Optional[str] = None ) -> Optional[BinaryIO]: + if data is None: return None compress = should_compress_output(args) if not compress: + # If we shan't compress, then at least make the output file sparse + with complete_step(f"Digging holes into output file {data.name}…"): + run(["fallocate", "--dig-holes", data.name]) + return data with complete_step(f"Compressing output file {data.name}…"): -- 2.47.2