From bf187e5c7d1780199b9ae4a885d444a12876f35d Mon Sep 17 00:00:00 2001 From: dong Date: Thu, 8 Jan 2026 10:53:51 +0800 Subject: [PATCH] fs: handle ENOTSUP error in compareCapabilities function commit container image (nerdctl commit) will failed to get xattr in filesystems without xattr support. ``` FATA[0006] failed to export layer: mount callback failed on /xxx/containerd/tmpmounts/containerd-mount1781253780: mount callback failed on /xxx/tmpmounts/containerd-mount4034463149: failed to write compressed diff: failed to create diff tar stream: failed to get xattr for /xxx/containerd/tmpmounts/containerd-mount4034463149/etc: operation not supported: unknown ``` when LGetxattr syscall return ENOTSUP error, continuity should handle it. Signed-off-by: dong --- fs/diff_unix.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/diff_unix.go b/fs/diff_unix.go index fe1b35d..44d6521 100644 --- a/fs/diff_unix.go +++ b/fs/diff_unix.go @@ -20,11 +20,13 @@ package fs import ( "bytes" + "errors" "fmt" "os" "syscall" "github.com/containerd/continuity/sysx" + "golang.org/x/sys/unix" ) // compareSysStat returns whether the stats are equivalent, @@ -45,11 +47,11 @@ func compareSysStat(s1, s2 interface{}) (bool, error) { func compareCapabilities(p1, p2 string) (bool, error) { c1, err := sysx.LGetxattr(p1, "security.capability") - if err != nil && err != sysx.ENODATA { + if err != nil && !errors.Is(err, unix.ENOTSUP) && !errors.Is(err, sysx.ENODATA) { return false, fmt.Errorf("failed to get xattr for %s: %w", p1, err) } c2, err := sysx.LGetxattr(p2, "security.capability") - if err != nil && err != sysx.ENODATA { + if err != nil && !errors.Is(err, unix.ENOTSUP) && !errors.Is(err, sysx.ENODATA) { return false, fmt.Errorf("failed to get xattr for %s: %w", p2, err) } return bytes.Equal(c1, c2), nil