Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <xiang@kernel.org>
To: mike.malyshev@gmail.com
Cc: linux-erofs@lists.ozlabs.org, Gao Xiang <xiang@kernel.org>
Subject: Re: [PATCH] erofs-utils: lib: follow symlinks on intermediate tar path components
Date: Sun, 2 Aug 2026 21:00:56 +0800	[thread overview]
Message-ID: <am8_iD0g9yTj2B1m@XiangdeMacBook-Pro.local> (raw)
In-Reply-To: <20260725150920.1900298-1-mike.malyshev@gmail.com>

Hi Mikhail,

On Sat, Jul 25, 2026 at 03:09:20PM +0000, mike.malyshev@gmail.com wrote:
> From: Mikhail Malyshev <mike.malyshev@gmail.com>
> 
> mkfs.erofs --tar fails to convert layers that store files underneath a
> symlinked directory, a very common "usr-merge" layout in RHEL/UBI/Fedora
> based OCI images.  For example a base layer contains
> 
>     lib64 -> usr/lib64        (symlink)
>     usr/lib64/                (directory)
>     lib64/libc.so.6           (regular file, path goes THROUGH the symlink)
> 
> erofs_rebuild_get_dentry() walks the path component by component and, when
> it hits the "lib64" component, finds an existing dentry that is a symlink
> rather than a directory.  Since there are still components left to resolve
> it bails out with -ENOTDIR.  In practice this surfaces as a bogus ~2 TiB
> image and "Could not format the device", making the whole layer
> unconvertible even though nothing is wrong with the tar.
> 
> A real filesystem (and containerd's walking differ, which applies the same
> layers via fs.RootPath) resolves such a path by following the symlink to
> its target directory.  Do the same during tar rebuild: when an intermediate
> path component resolves to a symlink, follow it to the target directory
> (relative targets from the containing directory, absolute targets from the
> tree root), chasing chained symlinks up to a bounded depth to avoid loops.
> 
> Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>

Thanks for the patch and sorry for late reply.

Yes, I assume containerd will resolve the directories like this, but as
a quick reference, could you give some pointer how `tar` utility works
and `posix` documents this behavior?

I plan to release erofs-utils 1.9.3 without this patch soon, and it can
be addressed in erofs-utils 1.9.4 version.

Thanks,
Gao Xiang


      reply	other threads:[~2026-08-02 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 15:09 [PATCH] erofs-utils: lib: follow symlinks on intermediate tar path components mike.malyshev
2026-08-02 13:00 ` 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=am8_iD0g9yTj2B1m@XiangdeMacBook-Pro.local \
    --to=xiang@kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=mike.malyshev@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox