mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: github.com/docker/docker v25.0.1
- pkg/system: return even richer xattr errors full diff: https://github.com/moby/moby/compare/v25.0.0-rc.1...v25.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
2
vendor/github.com/docker/docker/builder/remotecontext/urlutil/urlutil.go
generated
vendored
2
vendor/github.com/docker/docker/builder/remotecontext/urlutil/urlutil.go
generated
vendored
@ -12,7 +12,7 @@ import (
|
||||
|
||||
// urlPathWithFragmentSuffix matches fragments to use as Git reference and build
|
||||
// context from the Git repository. See IsGitURL for details.
|
||||
var urlPathWithFragmentSuffix = regexp.MustCompile(".git(?:#.+)?$")
|
||||
var urlPathWithFragmentSuffix = regexp.MustCompile(`\.git(?:#.+)?$`)
|
||||
|
||||
// IsURL returns true if the provided str is an HTTP(S) URL by checking if it
|
||||
// has a http:// or https:// scheme. No validation is performed to verify if the
|
||||
|
6
vendor/github.com/docker/docker/errdefs/is.go
generated
vendored
6
vendor/github.com/docker/docker/errdefs/is.go
generated
vendored
@ -9,6 +9,10 @@ type causer interface {
|
||||
Cause() error
|
||||
}
|
||||
|
||||
type wrapErr interface {
|
||||
Unwrap() error
|
||||
}
|
||||
|
||||
func getImplementer(err error) error {
|
||||
switch e := err.(type) {
|
||||
case
|
||||
@ -28,6 +32,8 @@ func getImplementer(err error) error {
|
||||
return err
|
||||
case causer:
|
||||
return getImplementer(e.Cause())
|
||||
case wrapErr:
|
||||
return getImplementer(e.Unwrap())
|
||||
default:
|
||||
return err
|
||||
}
|
||||
|
18
vendor/github.com/docker/docker/pkg/system/xattrs.go
generated
vendored
Normal file
18
vendor/github.com/docker/docker/pkg/system/xattrs.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
type XattrError struct {
|
||||
Op string
|
||||
Attr string
|
||||
Path string
|
||||
Err error
|
||||
}
|
||||
|
||||
func (e *XattrError) Error() string { return e.Op + " " + e.Attr + " " + e.Path + ": " + e.Err.Error() }
|
||||
|
||||
func (e *XattrError) Unwrap() error { return e.Err }
|
||||
|
||||
// Timeout reports whether this error represents a timeout.
|
||||
func (e *XattrError) Timeout() bool {
|
||||
t, ok := e.Err.(interface{ Timeout() bool })
|
||||
return ok && t.Timeout()
|
||||
}
|
12
vendor/github.com/docker/docker/pkg/system/xattrs_linux.go
generated
vendored
12
vendor/github.com/docker/docker/pkg/system/xattrs_linux.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
package system // import "github.com/docker/docker/pkg/system"
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@ -10,8 +8,8 @@ import (
|
||||
// and associated with the given path in the file system.
|
||||
// It will returns a nil slice and nil error if the xattr is not set.
|
||||
func Lgetxattr(path string, attr string) ([]byte, error) {
|
||||
pathErr := func(err error) ([]byte, error) {
|
||||
return nil, &fs.PathError{Op: "lgetxattr", Path: path, Err: err}
|
||||
sysErr := func(err error) ([]byte, error) {
|
||||
return nil, &XattrError{Op: "lgetxattr", Attr: attr, Path: path, Err: err}
|
||||
}
|
||||
|
||||
// Start with a 128 length byte array
|
||||
@ -22,7 +20,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) {
|
||||
// Buffer too small, use zero-sized buffer to get the actual size
|
||||
sz, errno = unix.Lgetxattr(path, attr, []byte{})
|
||||
if errno != nil {
|
||||
return pathErr(errno)
|
||||
return sysErr(errno)
|
||||
}
|
||||
dest = make([]byte, sz)
|
||||
sz, errno = unix.Lgetxattr(path, attr, dest)
|
||||
@ -32,7 +30,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) {
|
||||
case errno == unix.ENODATA:
|
||||
return nil, nil
|
||||
case errno != nil:
|
||||
return pathErr(errno)
|
||||
return sysErr(errno)
|
||||
}
|
||||
|
||||
return dest[:sz], nil
|
||||
@ -43,7 +41,7 @@ func Lgetxattr(path string, attr string) ([]byte, error) {
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) error {
|
||||
err := unix.Lsetxattr(path, attr, data, flags)
|
||||
if err != nil {
|
||||
return &fs.PathError{Op: "lsetxattr", Path: path, Err: err}
|
||||
return &XattrError{Op: "lsetxattr", Attr: attr, Path: path, Err: err}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user