Bump reva

This commit is contained in:
André Duffeck
2026-05-22 10:37:47 +02:00
parent fbc868522d
commit c336e4ae34
11 changed files with 113 additions and 82 deletions

2
go.mod
View File

@@ -64,7 +64,7 @@ require (
github.com/open-policy-agent/opa v1.15.2
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d
github.com/opencloud-eu/reva/v2 v2.46.0
github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e
github.com/opensearch-project/opensearch-go/v4 v4.6.0
github.com/orcaman/concurrent-map v1.0.0
github.com/pkg/errors v0.9.1

4
go.sum
View File

@@ -952,8 +952,8 @@ github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9 h1:dIft
github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9/go.mod h1:JWyDC6H+5oZRdUJUgKuaye+8Ph5hEs6HVzVoPKzWSGI=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d h1:JcqGDiyrcaQwVyV861TUyQgO7uEmsjkhfm7aQd84dOw=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
github.com/opencloud-eu/reva/v2 v2.46.0 h1:wYUHIHOsLP9vad/K19/52RRfoooeHUGY4BSeowNrbpY=
github.com/opencloud-eu/reva/v2 v2.46.0/go.mod h1:fWAzVpZlJQEY/qeIrd9d3U+LpqY9JGsjJ2dc0a1jCEs=
github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e h1:T/UAzT0TMNm6C6TasumVGUUZzl6yWsa8SDALXgPLy7Q=
github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e/go.mod h1:fWAzVpZlJQEY/qeIrd9d3U+LpqY9JGsjJ2dc0a1jCEs=
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 h1:l2oB/RctH+t8r7QBj5p8thfEHCM/jF35aAY3WQ3hADI=
github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=

View File

@@ -0,0 +1,84 @@
package ignore
import (
"path/filepath"
"strings"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/blobstore"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/lookup"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
"github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates"
"github.com/rs/zerolog"
)
// Ignorer handles checking if paths should be ignored in posix operations
type Ignorer struct {
options *options.Options
log *zerolog.Logger
personalSpacesRoot string
projectSpacesRoot string
}
// NewIgnorer creates a new Ignorer given the posix options and logger
func NewIgnorer(options *options.Options, log *zerolog.Logger) *Ignorer {
return &Ignorer{
options: options,
log: log,
personalSpacesRoot: filepath.Clean(filepath.Join(options.Root, templates.Base(options.PersonalSpacePathTemplate))),
projectSpacesRoot: filepath.Clean(filepath.Join(options.Root, templates.Base(options.GeneralSpacePathTemplate))),
}
}
// IsIgnored checking if paths should be ignored in posix operations
func (i *Ignorer) IsIgnored(path string) bool {
return IsLockFile(path) || IsTrash(path) || i.IsUpload(path) || i.IsInternal(path) || i.IsRootPath(path) || i.IsSpaceRoot(path)
}
func (i *Ignorer) IsUpload(path string) bool {
return strings.HasPrefix(path, i.options.UploadDirectory)
}
func (i *Ignorer) IsIndex(path string) bool {
return strings.HasPrefix(path, filepath.Join(i.options.Root, "indexes"))
}
func (i *Ignorer) IsTemporary(path string) bool {
if filepath.IsAbs(path) {
tmpDirPattern := filepath.Join(i.options.Root, "*", "*", blobstore.TMPDir)
isTempDir, err := filepath.Match(tmpDirPattern, path)
if err != nil {
i.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", path).Msg("error matching temporary path")
return false
}
isTempParentDir, err := filepath.Match(tmpDirPattern, filepath.Dir(path))
if err != nil {
i.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", filepath.Dir(path)).Msg("error matching temporary path")
return false
}
return isTempDir || isTempParentDir
}
return path == blobstore.TMPDir || filepath.Dir(path) == blobstore.TMPDir
}
func (i *Ignorer) IsRootPath(path string) bool {
return path == i.options.Root ||
path == i.personalSpacesRoot ||
path == i.projectSpacesRoot
}
func (i *Ignorer) IsSpaceRoot(path string) bool {
parent := filepath.Dir(path)
return parent == i.personalSpacesRoot || parent == i.projectSpacesRoot
}
func (i *Ignorer) IsInternal(path string) bool {
return i.IsIndex(path) || strings.Contains(path, lookup.MetadataDir) || i.IsTemporary(path)
}
func IsLockFile(path string) bool {
return strings.HasSuffix(path, ".flock") || strings.HasSuffix(path, ".mlock")
}
func IsTrash(path string) bool {
return strings.HasSuffix(path, ".trashinfo") || strings.HasSuffix(path, ".trashitem") || strings.Contains(path, ".Trash")
}

View File

@@ -41,6 +41,7 @@ import (
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
"github.com/opencloud-eu/reva/v2/pkg/events"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/watcher"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata/prefixes"
@@ -368,7 +369,7 @@ func (t *Tree) findSpaceId(path string) (string, error) {
spaceCandidate := path
for strings.HasPrefix(spaceCandidate, t.options.Root) {
// jail at root
if t.isRootPath(spaceCandidate) {
if t.Ignorer.IsRootPath(spaceCandidate) {
return "", ErrRootReached
}
@@ -709,7 +710,7 @@ assimilate:
// The Space's name attribute might not match the directory name. Use the name as
// it was set before. Also the space root doesn't have a 'type' attribute
// currently so only set it for normal directories.
if t.isSpaceRoot(path) {
if t.Ignorer.IsSpaceRoot(path) {
if previousAttribs != nil && previousAttribs[prefixes.NameAttr] != nil {
attributes[prefixes.NameAttr] = previousAttribs[prefixes.NameAttr]
}
@@ -866,17 +867,17 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
}
// skip irrelevant files
if t.isInternal(path) ||
isLockFile(path) ||
isTrash(path) ||
t.isUpload(path) ||
t.isIndex(path) {
if t.Ignorer.IsInternal(path) ||
ignore.IsLockFile(path) ||
ignore.IsTrash(path) ||
t.Ignorer.IsUpload(path) ||
t.Ignorer.IsIndex(path) {
if info.IsDir() {
return filepath.SkipDir
}
return nil
}
if t.isRootPath(path) {
if t.Ignorer.IsRootPath(path) {
return nil // ignore the root paths
}
@@ -982,7 +983,7 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
})
for dir, size := range sizes {
if t.isRootPath(dir) {
if t.Ignorer.IsRootPath(dir) {
continue
}
spaceID, id, err := t.lookup.IDsForPath(context.Background(), dir)

View File

@@ -84,7 +84,7 @@ func (w *CephFSWatcher) Watch(topic string) {
continue
}
if w.tree.isIgnored(ev.Path) {
if w.tree.Ignorer.IsIgnored(ev.Path) {
continue
}

View File

@@ -83,7 +83,7 @@ start:
w.log.Error().Err(err).Str("line", line).Msg("error unmarshalling line")
continue
}
if w.tree.isIgnored(ev.Path) {
if w.tree.Ignorer.IsIgnored(ev.Path) {
continue
}
go func() {

View File

@@ -66,7 +66,7 @@ func (w *GpfsWatchFolderWatcher) Watch(topic string) {
continue
}
if w.tree.isIgnored(lwev.Path) {
if w.tree.Ignorer.IsIgnored(lwev.Path) {
continue
}

View File

@@ -41,8 +41,8 @@ import (
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
"github.com/opencloud-eu/reva/v2/pkg/events"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/blobstore"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/idcache"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/lookup"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/trashbin"
@@ -54,7 +54,6 @@ import (
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/permissions"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/tree/propagator"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/usermapper"
"github.com/opencloud-eu/reva/v2/pkg/storage/utils/templates"
"github.com/opencloud-eu/reva/v2/pkg/utils"
)
@@ -93,9 +92,8 @@ type Tree struct {
idResolver IDResolver // points at the lookup but can be overridden for testing
assimilateFunc func(item scanItem) error // function to call to assimilate a node, can be overridden for testing
options *options.Options
personalSpacesRoot string
projectSpacesRoot string
options *options.Options
Ignorer *ignore.Ignorer
userMapper usermapper.Mapper
idCache *idcache.IDCache
@@ -128,10 +126,9 @@ func New(lu node.PathLookup, bs node.Blobstore, um usermapper.Mapper, trashbin *
scanDebouncer: NewScanDebouncer(o.ScanDebounceDelay, func(item scanItem) {
scanQueue <- item
}),
es: es,
log: log,
personalSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.PersonalSpacePathTemplate))),
projectSpacesRoot: filepath.Clean(filepath.Join(o.Root, templates.Base(o.GeneralSpacePathTemplate))),
es: es,
log: log,
Ignorer: ignore.NewIgnorer(o, log),
}
t.idResolver = t.lookup
t.assimilateFunc = t.assimilate
@@ -499,7 +496,7 @@ func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, erro
g.Go(func() error {
defer close(work)
for _, name := range names {
if t.isInternal(name) || isLockFile(name) || isTrash(name) {
if t.Ignorer.IsInternal(name) || ignore.IsLockFile(name) || ignore.IsTrash(name) {
continue
}
@@ -776,56 +773,3 @@ func (t *Tree) createDirNode(ctx context.Context, n *node.Node) (err error) {
}
return n.SetXattrsWithContext(ctx, attributes, false)
}
func (t *Tree) isIgnored(path string) bool {
return isLockFile(path) || isTrash(path) || t.isUpload(path) || t.isInternal(path) || t.isRootPath(path) || t.isSpaceRoot(path)
}
func (t *Tree) isUpload(path string) bool {
return strings.HasPrefix(path, t.options.UploadDirectory)
}
func (t *Tree) isIndex(path string) bool {
return strings.HasPrefix(path, filepath.Join(t.options.Root, "indexes"))
}
func (t *Tree) isTemporary(path string) bool {
if filepath.IsAbs(path) {
tmpDirPattern := filepath.Join(t.options.Root, "*", "*", blobstore.TMPDir)
isTempDir, err := filepath.Match(tmpDirPattern, path)
if err != nil {
t.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", path).Msg("error matching temporary path")
return false
}
isTempParentDir, err := filepath.Match(tmpDirPattern, filepath.Dir(path))
if err != nil {
t.log.Error().Err(err).Str("pattern", tmpDirPattern).Str("path", filepath.Dir(path)).Msg("error matching temporary path")
return false
}
return isTempDir || isTempParentDir
}
return path == blobstore.TMPDir || filepath.Dir(path) == blobstore.TMPDir
}
func (t *Tree) isRootPath(path string) bool {
return path == t.options.Root ||
path == t.personalSpacesRoot ||
path == t.projectSpacesRoot
}
func (t *Tree) isSpaceRoot(path string) bool {
parent := filepath.Dir(path)
return parent == t.personalSpacesRoot || parent == t.projectSpacesRoot
}
func (t *Tree) isInternal(path string) bool {
return t.isIndex(path) || strings.Contains(path, lookup.MetadataDir) || t.isTemporary(path)
}
func isLockFile(path string) bool {
return strings.HasSuffix(path, ".flock") || strings.HasSuffix(path, ".mlock")
}
func isTrash(path string) bool {
return strings.HasSuffix(path, ".trashinfo") || strings.HasSuffix(path, ".trashitem") || strings.Contains(path, ".Trash")
}

View File

@@ -12,6 +12,7 @@ import (
"github.com/fsnotify/fsnotify"
"github.com/rs/zerolog"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/watcher"
)
@@ -212,8 +213,8 @@ func isSubpath(root, p string) bool {
// isIgnored checks if the path is ignored by its tree.
func isPathIgnored(tree *Tree, path string) bool {
isLockFile := isLockFile(path)
isTrash := isTrash(path)
isLockFile := ignore.IsLockFile(path)
isTrash := ignore.IsTrash(path)
isUpload := tree.isUpload(path)
isInternal := tree.isInternal(path)

View File

@@ -90,7 +90,7 @@ func (iw *InotifyWatcher) Watch(path string) {
for {
select {
case event := <-events:
if iw.tree.isIgnored(event.Filename) {
if iw.tree.Ignorer.IsIgnored(event.Filename) {
continue
}
for _, e := range event.Events {

3
vendor/modules.txt vendored
View File

@@ -1363,7 +1363,7 @@ github.com/opencloud-eu/icap-client
# github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d
## explicit; go 1.18
github.com/opencloud-eu/libre-graph-api-go
# github.com/opencloud-eu/reva/v2 v2.46.0
# github.com/opencloud-eu/reva/v2 v2.46.1-0.20260522083006-063ee129f21e
## explicit; go 1.25.0
github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace
github.com/opencloud-eu/reva/v2/cmd/revad/runtime
@@ -1651,6 +1651,7 @@ github.com/opencloud-eu/reva/v2/pkg/storage/fs/owncloudsql/filecache
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/blobstore
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/idcache
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/ignore
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/lookup
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options
github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/timemanager