]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
make_tar: do not emit extended PAX headers for atime, ctime and mtime
authorMalte Poll <mp@edgeless.systems>
Tue, 17 Oct 2023 08:37:16 +0000 (10:37 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 17 Oct 2023 09:06:15 +0000 (11:06 +0200)
The use of the --xattrs flag implies PAX headers (--format=pax).
In this mode, the tar will record atime, ctime and mtime as PAX headers (in addition to the usual USTAR header).
Removing the headers makes the output reproducible.
See also: https://www.gnu.org/software/tar/manual/html_node/PAX-keywords.html

mkosi/archive.py

index 07e9634eecdd6a81d5452a77b492a84224cb4da4..a08e9092df0612533f2bc9e89bf952ac0824b97e 100644 (file)
@@ -46,7 +46,11 @@ def make_tar(src: Path, dst: Path) -> None:
             "--directory", src,
             "--acls",
             "--selinux",
+            # --xattrs implies --format=pax
             "--xattrs",
+            # PAX format emits additional headers for atime, ctime and mtime
+            # that would make the archive non-reproducible.
+            "--pax-option=delete=atime,delete=ctime,delete=mtime",
             "--sparse",
             "--force-local",
             *tar_exclude_apivfs_tmp(),