1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

pkg: archive: don't fail Untar if xattrs are not supported

Since certain filesystems don't support extended attributes, ignore
errors produced (emitting a warning) when attempting to apply extended
attributes to file.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai 2016-03-16 22:54:57 +11:00 committed by Aleksa Sarai
parent aa76ddd353
commit 75a271603c

View file

@ -425,10 +425,19 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
} }
} }
var errors []string
for key, value := range hdr.Xattrs { for key, value := range hdr.Xattrs {
if err := system.Lsetxattr(path, key, []byte(value), 0); err != nil { if err := system.Lsetxattr(path, key, []byte(value), 0); err != nil {
return err // We ignore errors here because not all graphdrivers support xattrs.
errors = append(errors, err.Error())
} }
}
if len(errors) > 0 {
logrus.WithFields(logrus.Fields{
"errors": errors,
}).Warn("ignored xattrs in archive: underlying filesystem doesn't support them")
} }
// There is no LChmod, so ignore mode for symlink. Also, this // There is no LChmod, so ignore mode for symlink. Also, this