Skip to content

Commit

Permalink
avoid failing when lgetxattr has no data to give
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
hallyn committed Jan 24, 2024
1 parent 9da0fd4 commit ad8ce08
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions oci/layer/tar_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,14 @@ func (tg *tarGenerator) AddFile(name, path string) error {
// (we'd need to use libcap to parse it).
value, err := tg.fsEval.Lgetxattr(path, name)
if err != nil {
// 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).
return errors.Wrapf(err, "get xattr: %s", name)
v := errors.Cause(err)
log.Debugf("failure reading xattr from list on %q: %q", name, v)
if v != unix.EOPNOTSUPP && v != unix.ENODATA {
// 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).
return errors.Wrapf(err, "get xattr: %s", name)
}
}
// https://golang.org/issues/20698 -- We don't just error out here
// because it's not _really_ a fatal error. Currently it's unclear
Expand Down

0 comments on commit ad8ce08

Please sign in to comment.