diff --git a/pkg/eosclient/eosbinary/eosbinary.go b/pkg/eosclient/eosbinary/eosbinary.go index aacfcfcf52..7e83d6d03e 100644 --- a/pkg/eosclient/eosbinary/eosbinary.go +++ b/pkg/eosclient/eosbinary/eosbinary.go @@ -254,9 +254,10 @@ func (c *Client) executeEOS(ctx context.Context, cmdArgs []string, auth eosclien err = nil case int(syscall.ENOENT): err = errtypes.NotFound(errBuf.String()) - case int(syscall.EPERM), int(syscall.E2BIG), int(syscall.EINVAL): + case int(syscall.EPERM), int(syscall.E2BIG), int(syscall.EINVAL), int(syscall.EACCES): // eos reports back error code 1 (EPERM) when ? // eos reports back error code 7 (E2BIG) when the user is not allowed to read the directory + // eos reports back error code 13 (EACCES) wheb the user is not allowed to read the directory in e.g. eos newfind // eos reports back error code 22 (EINVAL) when the user is not allowed to enter the instance err = errtypes.PermissionDenied(errBuf.String()) } @@ -746,7 +747,7 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, path st // List the contents of the directory given by path with depth infinity func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, searchString string, path string) ([]*eosclient.FileInfo, error) { // TODO(salfagem): path is truncated - i.e. /c/cernbox (not absolute) - args := []string{"find", "--fileinfo", "-name", searchString, path} + args := []string{"newfind", "--fileinfo", "-name", searchString, path} log := appctx.GetLogger(ctx) log.Debug().Msgf("eosbinary search with args: %s", args) // Safeguard #2 to prevent the search to go to undesired places: @@ -763,7 +764,12 @@ func (c *Client) SearchDir(ctx context.Context, auth eosclient.Authorization, se // TODO: set a timeout for the find in case it goes out of hand stdout, _, err := c.executeEOS(ctx, args, auth) if err != nil { - return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path) + switch err.(type) { + case errtypes.NotFound, errtypes.PermissionDenied: + log.Debug().Msgf("eosbinary - user had insufficient permissions to search part of the directory") + default: + return nil, errors.Wrapf(err, "eosclient: error listing fn=%s", path) + } } return c.parseFind(ctx, auth, path, stdout) }