From: Lennart Poettering Date: Fri, 8 Oct 2021 10:40:13 +0000 (+0200) Subject: mkosi: when done, dig out all holes (unless we compress anyway) X-Git-Tag: v11~34^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F830%2Fhead;p=thirdparty%2Fmkosi.git 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. --- 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}…"):