Files
systemd/src
Lennart Poettering 385eaf8f94 import: drain trailing archive null padding in tar-x child
libarchive stops reading as soon as it hits the end-of-archive marker,
but tar archives are usually padded with zeroes to a full record size
after that (GNU tar uses 10K records by default). Since the tar-x child
then exits right away, the importer's final write of that padding can
race against the child exiting and fail with EPIPE:

    Imported 88%.
    Failed to decode and write: Broken pipe

The child exits successfully in this case, hence no tar error is logged
at all. Seen in TEST-13-NSPAWN on "machinectl import-tar" of a
"tar -czf" generated tarball.

Fix this by reading the input pipe to EOF after tar_x() returns
successfully, verifying that whatever follows the end-of-archive marker
is all zeroes, and refusing the archive otherwise. This affects
importctl import-tar as well as pull-tar and pull-oci.

This addresses Ci failures such as:

https://github.com/systemd/systemd/actions/runs/38738219126/job/116432869392?pr=44163
(cherry picked from commit 9c852031ec8178256196380dc9866553ce37842f)
2026-10-16 17:24:52 +01:00
..
…
2026-10-16 17:24:51 +01:00
2026-09-22 18:14:12 +09:00
2026-10-16 17:24:51 +01:00
2026-08-31 16:57:19 +01:00