From 98c7c196a611615620fe54f98a09b0650bcd6d2d Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 16 Mar 2016 22:54:57 +1100 Subject: [PATCH] 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 --- pkg/archive/archive.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/archive/archive.go b/pkg/archive/archive.go index 1281683ee474f..f48d82124b785 100644 --- a/pkg/archive/archive.go +++ b/pkg/archive/archive.go @@ -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 { 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