diff --git a/drivers/chown_darwin.go b/drivers/chown_darwin.go index 882fa04bd0..4f27502073 100644 --- a/drivers/chown_darwin.go +++ b/drivers/chown_darwin.go @@ -83,7 +83,7 @@ func (c *platformChowner) LChown(path string, info os.FileInfo, toHost, toContai } if uid != int(st.Uid) || gid != int(st.Gid) { capability, err := system.Lgetxattr(path, "security.capability") - if err != nil && !errors.Is(err, system.EOPNOTSUPP) && err != system.ErrNotSupportedPlatform { + if err != nil && !errors.Is(err, system.ENOTSUP) && err != system.ErrNotSupportedPlatform { return fmt.Errorf("%s: %w", os.Args[0], err) } diff --git a/drivers/chown_unix.go b/drivers/chown_unix.go index 808f4fea66..b0c25cd992 100644 --- a/drivers/chown_unix.go +++ b/drivers/chown_unix.go @@ -101,7 +101,7 @@ func (c *platformChowner) LChown(path string, info os.FileInfo, toHost, toContai } if uid != int(st.Uid) || gid != int(st.Gid) { cap, err := system.Lgetxattr(path, "security.capability") - if err != nil && !errors.Is(err, system.EOPNOTSUPP) && !errors.Is(err, system.EOVERFLOW) && err != system.ErrNotSupportedPlatform { + if err != nil && !errors.Is(err, system.ENOTSUP) && !errors.Is(err, system.EOVERFLOW) && err != system.ErrNotSupportedPlatform { return fmt.Errorf("%s: %w", os.Args[0], err) } diff --git a/drivers/copy/copy_linux.go b/drivers/copy/copy_linux.go index 8c0bbed618..93fc0a3261 100644 --- a/drivers/copy/copy_linux.go +++ b/drivers/copy/copy_linux.go @@ -106,7 +106,7 @@ func legacyCopy(srcFile io.Reader, dstFile io.Writer) error { func copyXattr(srcPath, dstPath, attr string) error { data, err := system.Lgetxattr(srcPath, attr) - if err != nil && !errors.Is(err, unix.EOPNOTSUPP) { + if err != nil && !errors.Is(err, system.ENOTSUP) { return err } if data != nil { @@ -279,7 +279,7 @@ func doCopyXattrs(srcPath, dstPath string) error { } xattrs, err := system.Llistxattr(srcPath) - if err != nil && !errors.Is(err, unix.EOPNOTSUPP) { + if err != nil && !errors.Is(err, system.ENOTSUP) { return err } diff --git a/drivers/overlay/check_116.go b/drivers/overlay/check_116.go index 7867d50063..5cbf5e1cef 100644 --- a/drivers/overlay/check_116.go +++ b/drivers/overlay/check_116.go @@ -10,7 +10,6 @@ import ( "github.com/containers/storage/pkg/archive" "github.com/containers/storage/pkg/system" - "golang.org/x/sys/unix" ) func scanForMountProgramIndicators(home string) (detected bool, err error) { @@ -28,7 +27,7 @@ func scanForMountProgramIndicators(home string) (detected bool, err error) { } if d.IsDir() { xattrs, err := system.Llistxattr(path) - if err != nil && !errors.Is(err, unix.EOPNOTSUPP) { + if err != nil && !errors.Is(err, system.ENOTSUP) { return err } for _, xattr := range xattrs { diff --git a/pkg/archive/archive.go b/pkg/archive/archive.go index 45802acf36..64e6293d36 100644 --- a/pkg/archive/archive.go +++ b/pkg/archive/archive.go @@ -427,7 +427,7 @@ func readSecurityXattrToTarHeader(path string, hdr *tar.Header) error { } for _, xattr := range []string{"security.capability", "security.ima"} { capability, err := system.Lgetxattr(path, xattr) - if err != nil && !errors.Is(err, system.EOPNOTSUPP) && err != system.ErrNotSupportedPlatform { + if err != nil && !errors.Is(err, system.ENOTSUP) && err != system.ErrNotSupportedPlatform { return fmt.Errorf("failed to read %q attribute from %q: %w", xattr, path, err) } if capability != nil { @@ -440,7 +440,7 @@ func readSecurityXattrToTarHeader(path string, hdr *tar.Header) error { // readUserXattrToTarHeader reads user.* xattr from filesystem to a tar header func readUserXattrToTarHeader(path string, hdr *tar.Header) error { xattrs, err := system.Llistxattr(path) - if err != nil && !errors.Is(err, system.EOPNOTSUPP) && err != system.ErrNotSupportedPlatform { + if err != nil && !errors.Is(err, system.ENOTSUP) && err != system.ErrNotSupportedPlatform { return err } for _, key := range xattrs { @@ -793,7 +793,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L continue } if err := system.Lsetxattr(path, xattrKey, []byte(value), 0); err != nil { - if errors.Is(err, syscall.ENOTSUP) || (inUserns && errors.Is(err, syscall.EPERM)) { + if errors.Is(err, system.ENOTSUP) || (inUserns && errors.Is(err, syscall.EPERM)) { // Ignore specific error cases: // - ENOTSUP: Expected for graphdrivers lacking extended attribute support: // - Legacy AUFS versions diff --git a/pkg/archive/changes_linux.go b/pkg/archive/changes_linux.go index dc308120dc..7e673592ed 100644 --- a/pkg/archive/changes_linux.go +++ b/pkg/archive/changes_linux.go @@ -87,11 +87,11 @@ func walkchunk(path string, fi os.FileInfo, dir string, root *FileInfo) error { } info.stat = stat info.capability, err = system.Lgetxattr(cpath, "security.capability") // lgetxattr(2): fs access - if err != nil && !errors.Is(err, system.EOPNOTSUPP) { + if err != nil && !errors.Is(err, system.ENOTSUP) { return err } xattrs, err := system.Llistxattr(cpath) - if err != nil && !errors.Is(err, system.EOPNOTSUPP) { + if err != nil && !errors.Is(err, system.ENOTSUP) { return err } for _, key := range xattrs { diff --git a/pkg/system/xattrs_darwin.go b/pkg/system/xattrs_darwin.go index 75275b964e..27ada2083e 100644 --- a/pkg/system/xattrs_darwin.go +++ b/pkg/system/xattrs_darwin.go @@ -12,7 +12,7 @@ const ( E2BIG unix.Errno = unix.E2BIG // Operation not supported - EOPNOTSUPP unix.Errno = unix.EOPNOTSUPP + ENOTSUP unix.Errno = unix.ENOTSUP ) // Lgetxattr retrieves the value of the extended attribute identified by attr diff --git a/pkg/system/xattrs_freebsd.go b/pkg/system/xattrs_freebsd.go index ef8af475d9..5d653976e5 100644 --- a/pkg/system/xattrs_freebsd.go +++ b/pkg/system/xattrs_freebsd.go @@ -2,7 +2,6 @@ package system import ( "strings" - "syscall" "golang.org/x/sys/unix" ) @@ -12,7 +11,7 @@ const ( E2BIG unix.Errno = unix.E2BIG // Operation not supported - EOPNOTSUPP unix.Errno = unix.EOPNOTSUPP + ENOTSUP unix.Errno = unix.ENOTSUP // Value is too small or too large for maximum size allowed EOVERFLOW unix.Errno = unix.EOVERFLOW @@ -28,12 +27,12 @@ var ( func xattrToExtattr(xattr string) (namespace int, extattr string, err error) { namespaceName, extattr, found := strings.Cut(xattr, ".") if !found { - return -1, "", syscall.ENOTSUP + return -1, "", ENOTSUP } namespace, ok := namespaceMap[namespaceName] if !ok { - return -1, "", syscall.ENOTSUP + return -1, "", ENOTSUP } return namespace, extattr, nil } @@ -56,7 +55,7 @@ func Lsetxattr(path string, attr string, value []byte, flags int) error { // FIXME: Flags are not supported on FreeBSD, but we can implement // them mimicking the behavior of the Linux implementation. // See lsetxattr(2) on Linux for more information. - return syscall.ENOTSUP + return ENOTSUP } namespace, extattr, err := xattrToExtattr(attr) diff --git a/pkg/system/xattrs_linux.go b/pkg/system/xattrs_linux.go index 6b47c4e717..12462cca33 100644 --- a/pkg/system/xattrs_linux.go +++ b/pkg/system/xattrs_linux.go @@ -12,7 +12,7 @@ const ( E2BIG unix.Errno = unix.E2BIG // Operation not supported - EOPNOTSUPP unix.Errno = unix.EOPNOTSUPP + ENOTSUP unix.Errno = unix.ENOTSUP // Value is too small or too large for maximum size allowed EOVERFLOW unix.Errno = unix.EOVERFLOW diff --git a/pkg/system/xattrs_unsupported.go b/pkg/system/xattrs_unsupported.go index cc3b19225c..66bf5858f6 100644 --- a/pkg/system/xattrs_unsupported.go +++ b/pkg/system/xattrs_unsupported.go @@ -9,7 +9,7 @@ const ( E2BIG syscall.Errno = syscall.Errno(0) // Operation not supported - EOPNOTSUPP syscall.Errno = syscall.Errno(0) + ENOTSUP syscall.Errno = syscall.Errno(0) // Value is too small or too large for maximum size allowed EOVERFLOW syscall.Errno = syscall.Errno(0)