Просмотр исходного кода

Merge pull request #23410 from cyphar/fix-xattr-ignore

pkg: archive: only ignore ENOTSUP when xattr fails
Sebastiaan van Stijn 9 лет назад
Родитель
Сommit
4a3b9a606b
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      pkg/archive/archive.go

+ 9 - 2
pkg/archive/archive.go

@@ -428,8 +428,15 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
 	var errors []string
 	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 {
-			// We ignore errors here because not all graphdrivers support xattrs.
-			errors = append(errors, err.Error())
+			if err == syscall.ENOTSUP {
+				// We ignore errors here because not all graphdrivers support
+				// xattrs *cough* old versions of AUFS *cough*. However only
+				// ENOTSUP should be emitted in that case, otherwise we still
+				// bail.
+				errors = append(errors, err.Error())
+				continue
+			}
+			return err
 		}
 		}
 
 
 	}
 	}