From 685e414451a5b6ef7f5a45661af59b606e1ff021 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Wed, 4 Oct 2023 15:07:12 -0500 Subject: [PATCH] tarGenerator.AddFile: ignore llistxattr eopnotsupp If it's not supported, just assume there are no xattrs, don't fail the addfile. Changelog: 10/18: use errors.Cause as suggested by Tycho Signed-off-by: Serge Hallyn --- oci/layer/tar_generate.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oci/layer/tar_generate.go b/oci/layer/tar_generate.go index 955190e69..76b35ca37 100644 --- a/oci/layer/tar_generate.go +++ b/oci/layer/tar_generate.go @@ -29,6 +29,7 @@ import ( "github.com/opencontainers/umoci/pkg/system" "github.com/opencontainers/umoci/pkg/testutils" "github.com/pkg/errors" + "golang.org/x/sys/unix" ) // ignoreXattrs is a list of xattr names that should be ignored when @@ -201,7 +202,10 @@ func (tg *tarGenerator) AddFile(name, path string) error { // XXX: This should probably be moved to a function in tar_unix.go. names, err := tg.fsEval.Llistxattr(path) if err != nil { - return errors.Wrap(err, "get xattr list") + if errors.Cause(err) != unix.EOPNOTSUPP { + return errors.Wrap(err, "get xattr list") + } + names = []string{} } for _, name := range names { // Some xattrs need to be skipped for sanity reasons, such as