From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Ivan Mikheykin <ivan.mikheykin@flant.com>, Gao Xiang <xiang@kernel.org>
Cc: linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH v2] erofs-utils: tar: support archives without end-of-archive entry
Date: Thu, 2 Oct 2025 08:39:41 +0800 [thread overview]
Message-ID: <e7bc9ed6-a097-4cde-85bd-e2b6c12d618a@linux.alibaba.com> (raw)
In-Reply-To: <20251001171341.87845-1-ivan.mikheykin@flant.com>
On 2025/10/2 01:13, Ivan Mikheykin wrote:
> Tar standard https://www.gnu.org/software/tar/manual/html_node/Standard.html
> says that archive "terminated by an end-of-archive entry,
> which consists of two 512 blocks of zero bytes".
>
> Is also says:
>
> "A reasonable system should write such end-of-file marker at the end
> of an archive, but must not assume that such a block exists when
> reading an archive. In particular, GNU tar does not treat missing
> end-of-file marker as an error and silently ignores the fact."
>
> It is rare for erofs to encounter such problem, as images are mostly
> built with docker or buildah. But if you create image using tar library
> in Golang directly uploading layers to registry, you'll get tar layers
> without end-of-archive block. Running containers with such images will
> trigger this error during extraction:
>
> mkfs.erofs --tar=f --aufs --quiet -Enoinline_data test.erofs test-no-end.tar
> <E> erofs: failed to read header block @ 42496
> <E> erofs: Could not format the device : [Error 5] Input/output error
>
> This patch fixes the problem by assuming that eof is equal to the end-of-archive.
>
> Reproducible tar without end-of-archive (base64-encoded gzipped blob):
> H4sICKVi2mgAA3Rlc3QtMTAtMi1ibG9ja3MudGFyAAtzDQr29PdjoCUwAAIzExMwbW5mCqYN
> jQzANBgYGTEYmhqYmpqamRoaGTMYGBqaGJkyKBjQ1FVQUFpcklikoMCQkpmYll9ahFNdYkpu
> Zh49HERfYKhnoWdowGVkYGSqa2Cua2jKNdAuGgX0BADwFwqsAAQAAA==
>
> Also, add warning about non-conformant tar layers:
>
> mkfs.erofs --tar=f --aufs -Enoinline_data test.erofs test-no-end.tar
> mkfs.erofs 1.8.10-g0a2bc574-dirty
> <W> erofs: unexpected end of file @ 1024 (may be non-standard tar without end of archive zeros)
> Build completed.
> ...
>
> Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Thanks, will apply.
Thanks,
Gao Xiang
prev parent reply other threads:[~2025-10-02 0:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 13:32 [PATCH] erofs-utils: tar: support archives without end-of-archive entry Ivan Mikheykin
2025-09-29 14:50 ` Gao Xiang
2025-09-30 7:42 ` Ivan Mikheykin
2025-09-30 8:01 ` Gao Xiang
2025-09-30 8:08 ` Gao Xiang
2025-10-01 17:13 ` [PATCH v2] " Ivan Mikheykin
2025-10-02 0:39 ` Gao Xiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7bc9ed6-a097-4cde-85bd-e2b6c12d618a@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=ivan.mikheykin@flant.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.