mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-27 18:45:04 -05:00
Point the go-micro.dev/v4 replace at the latest main-v4 maintenance branch commit in butonic/go-micro (cd412c15) instead of the v4.11.3 tag. The new base is upstream v4.11.1 plus the registry cache node-TTL fixes (upstream #2715, #2736, #2740), the concurrent map access fix (upstream #2794), plus further dependency updates and test fixes on the maintenance branch. The branch also modernizes go-micro's own go.mod (go 1.26, lego, dario.cat/mergo v1, x/deque v2, ...), and MVS pulls the aligned versions into this module: lego v4.35.2 -> lego/v5 v5.5.2, go-jose/go-jose/v4 -> v4.1.5, gofrs/flock -> v0.13.1, mattn/go-isatty -> v0.0.24, go.uber.org/zap -> v1.28.0, x/net -> 0.59.0, miekg/dns -> 1.1.73, moby api/client, ProtonMail/go-crypto -> 1.5.2, klauspost/compress -> 1.20.1, gorilla/handlers -> 1.5.2, gobwas/ws -> 1.4.0, nxadm/tail -> 1.4.11, ... Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
//go:build linux || darwin || freebsd || netbsd
|
|
|
|
package archive
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"io/fs"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// lgetxattr retrieves the value of the extended attribute identified by attr
|
|
// and associated with the given path in the file system.
|
|
// It returns a nil slice and nil error if the xattr is not set.
|
|
func lgetxattr(filePath string, attr string) ([]byte, error) {
|
|
// Start with a 128 length byte array
|
|
dest := make([]byte, 128)
|
|
sz, err := unix.Lgetxattr(filePath, attr, dest)
|
|
|
|
for errors.Is(err, unix.ERANGE) {
|
|
// Buffer too small, use zero-sized buffer to get the actual size
|
|
sz, err = unix.Lgetxattr(filePath, attr, []byte{})
|
|
if err != nil {
|
|
return nil, wrapPathError("lgetxattr", filePath, attr, err)
|
|
}
|
|
dest = make([]byte, sz)
|
|
sz, err = unix.Lgetxattr(filePath, attr, dest)
|
|
}
|
|
|
|
if err != nil {
|
|
if errors.Is(err, noattr) {
|
|
return nil, nil
|
|
}
|
|
return nil, wrapPathError("lgetxattr", filePath, attr, err)
|
|
}
|
|
|
|
return dest[:sz], nil
|
|
}
|
|
|
|
// lsetxattr sets the value of the extended attribute identified by attr
|
|
// and associated with the given path in the file system.
|
|
func lsetxattr(filePath string, attr string, data []byte, flags int) error {
|
|
return wrapPathError("lsetxattr", filePath, attr, unix.Lsetxattr(filePath, attr, data, flags))
|
|
}
|
|
|
|
func wrapPathError(op, filePath, attr string, err error) error {
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
return &fs.PathError{Op: op, Path: filePath, Err: fmt.Errorf("xattr %q: %w", attr, err)}
|
|
}
|