Browse code

pkg: archive: only ignore ENOTSUP when xattr fails

There might be other (valid) reasons for setxattr(2) to fail, so only
ignore it when it's a not supported error (ENOTSUP). Otherwise, bail.

Signed-off-by: Aleksa Sarai <asarai@suse.de>

Aleksa Sarai authored on 2016/06/09 23:24:04
Showing 1 changed files
... ...
@@ -428,8 +428,15 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
428 428
 	var errors []string
429 429
 	for key, value := range hdr.Xattrs {
430 430
 		if err := system.Lsetxattr(path, key, []byte(value), 0); err != nil {
431
-			// We ignore errors here because not all graphdrivers support xattrs.
432
-			errors = append(errors, err.Error())
431
+			if err == syscall.ENOTSUP {
432
+				// We ignore errors here because not all graphdrivers support
433
+				// xattrs *cough* old versions of AUFS *cough*. However only
434
+				// ENOTSUP should be emitted in that case, otherwise we still
435
+				// bail.
436
+				errors = append(errors, err.Error())
437
+				continue
438
+			}
439
+			return err
433 440
 		}
434 441
 
435 442
 	}