Skip to content

Commit

Permalink
Ignore error when xattr data is not available
Browse files Browse the repository at this point in the history
When the underlying filesystem is overlayfs, it is possible that xattrs
are present but without the data. So check for this case specifically
and ignore it.

Signed-off-by: Ramkumar Chinchani <[email protected]>
  • Loading branch information
rchincha committed Jan 30, 2023
1 parent fb2db51 commit 356a796
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions oci/layer/tar_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"

"github.com/apex/log"
"github.com/opencontainers/umoci/pkg/fseval"
Expand Down Expand Up @@ -217,6 +218,14 @@ func (tg *tarGenerator) AddFile(name, path string) error {
// XXX: I'm not sure if we're unprivileged whether Lgetxattr can
// fail with EPERM. If it can, we should ignore it (like when
// we try to clear xattrs).

// in case of overlayfs, we may not get the xattr data itself,
// so ignore if this particular error code
if err == syscall.ENODATA {
log.Warnf("unable to get xattr: %s", name)
continue
}

return errors.Wrapf(err, "get xattr: %s", name)
}
// https://golang.org/issues/20698 -- We don't just error out here
Expand Down

0 comments on commit 356a796

Please sign in to comment.