Skip to content

Commit 75b1c65

Browse files
authored
Merge pull request #245 from sondavidb/properly-handle-fs-without-xattrs
fs: properly handle ENOTSUP in copyXAttrs
2 parents cb01a52 + c494f3d commit 75b1c65

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

fs/copy_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package fs
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"os"
2223
"syscall"
@@ -64,6 +65,9 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
6465
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
6566
xattrKeys, err := sysx.LListxattr(src)
6667
if err != nil {
68+
if errors.Is(err, unix.ENOTSUP) {
69+
return nil
70+
}
6771
e := fmt.Errorf("failed to list xattrs on %s: %w", src, err)
6872
if errorHandler != nil {
6973
e = errorHandler(dst, src, "", e)

fs/copy_unix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
package fs
2121

2222
import (
23+
"errors"
2324
"fmt"
2425
"os"
2526
"runtime"
2627
"syscall"
2728

2829
"github.com/containerd/continuity/sysx"
30+
"golang.org/x/sys/unix"
2931
)
3032

3133
func copyFileInfo(fi os.FileInfo, src, name string) error {
@@ -67,6 +69,9 @@ func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAtt
6769
// On darwin, character devices do not permit listing xattrs
6870
return nil
6971
}
72+
if errors.Is(err, unix.ENOTSUP) {
73+
return nil
74+
}
7075
e := fmt.Errorf("failed to list xattrs on %s: %w", src, err)
7176
if errorHandler != nil {
7277
e = errorHandler(dst, src, "", e)

0 commit comments

Comments
 (0)