diff --git a/go.mod b/go.mod index 5020e8b18..c3c6ad9a4 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/onsi/gomega v1.37.0 github.com/open-policy-agent/opa v1.6.0 github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 - github.com/opencloud-eu/reva/v2 v2.35.1-0.20250806151828-b3ba930998b3 + github.com/opencloud-eu/reva/v2 v2.36.0 github.com/orcaman/concurrent-map v1.0.0 github.com/pkg/errors v0.9.1 github.com/pkg/xattr v0.4.12 diff --git a/go.sum b/go.sum index e475d498b..6ccdcd5a5 100644 --- a/go.sum +++ b/go.sum @@ -868,8 +868,8 @@ github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-202505121527 github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 h1:vD/EdfDUrv4omSFjrinT8Mvf+8D7f9g4vgQ2oiDrVUI= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= -github.com/opencloud-eu/reva/v2 v2.35.1-0.20250806151828-b3ba930998b3 h1:vFkByH3taFxFGav4lifAJjMcuYE1TopUtNIMYz4jqYw= -github.com/opencloud-eu/reva/v2 v2.35.1-0.20250806151828-b3ba930998b3/go.mod h1:/FyYaUWxtllu8TOcIIx53BjChc+hSpcQicBI/OTICjw= +github.com/opencloud-eu/reva/v2 v2.36.0 h1:5FBjhXqW8F4v7F76vGYpH7IGuRtcbKHoyOyj3syG7W8= +github.com/opencloud-eu/reva/v2 v2.36.0/go.mod h1:/FyYaUWxtllu8TOcIIx53BjChc+hSpcQicBI/OTICjw= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= diff --git a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go index c15e7ba67..fa6f5152a 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go +++ b/vendor/github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/tree/tree.go @@ -31,6 +31,7 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" + "github.com/pkg/xattr" "github.com/rs/zerolog" "go-micro.dev/v4/store" "go.opentelemetry.io/otel" @@ -117,6 +118,9 @@ func New(lu node.PathLookup, bs node.Blobstore, um usermapper.Mapper, trashbin * personalSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.PersonalSpacePathTemplate))), projectSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.GeneralSpacePathTemplate))), } + if err := t.checkStorage(); err != nil { + return nil, errors.Wrap(err, "tree: unfit storage '"+o.Root+"'") + } // Start watching for fs events and put them into the queue if o.WatchFS { @@ -161,6 +165,51 @@ func New(lu node.PathLookup, bs node.Blobstore, um usermapper.Mapper, trashbin * return t, nil } +func (t *Tree) checkStorage() error { + // check if the root path is a directory + err := os.MkdirAll(t.options.Root, 0700) + if err != nil { + return errors.Wrap(err, "could not create root path") + } + fi, err := os.Stat(t.options.Root) + if err != nil { + return errors.Wrap(err, "root path does not exist") + } + if !fi.IsDir() { + return errors.New("root path is not a directory") + } + + // check if extended attributes are supported + f, err := os.CreateTemp(t.options.Root, "posixfs-xattr-check-") + if err != nil { + return errors.Wrap(err, "could not create file in root path") + } + err = f.Close() + if err != nil { + return errors.Wrap(err, "could not close temp file") + } + defer func() { + if err := os.Remove(f.Name()); err != nil { + t.log.Error().Err(err).Str("path", f.Name()).Msg("could not remove temp file") + } + }() + + attrKey := "user.posixfs.test" + attrVal := []byte("test") + if err := xattr.Set(f.Name(), attrKey, attrVal); err != nil { + return errors.Wrap(err, "extended attributes not supported") + } + + val, err := xattr.Get(f.Name(), attrKey) + if err != nil { + return errors.Wrap(err, "extended attributes not supported") + } + if string(val) != string(attrVal) { + return errors.New("extended attribute mismatch") + } + return nil +} + func (t *Tree) PublishEvent(ev interface{}) { if t.es == nil { return diff --git a/vendor/modules.txt b/vendor/modules.txt index 6558e6e44..f6b8ce1ce 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1213,7 +1213,7 @@ github.com/open-policy-agent/opa/v1/version # github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 ## explicit; go 1.18 github.com/opencloud-eu/libre-graph-api-go -# github.com/opencloud-eu/reva/v2 v2.35.1-0.20250806151828-b3ba930998b3 +# github.com/opencloud-eu/reva/v2 v2.36.0 ## explicit; go 1.24.1 github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace github.com/opencloud-eu/reva/v2/cmd/revad/runtime