Skip to content

Commit

Permalink
Return ENAMETOOLONG when name is too long
Browse files Browse the repository at this point in the history
This allows more pjdfstests to pass.  References GoogleCloudPlatform#590.
  • Loading branch information
gaul committed Dec 23, 2022
1 parent 98f27f5 commit 5d0bb5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/fs/inode/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"path"
"strings"
"syscall"
"time"

"github.com/googlecloudplatform/gcsfuse/internal/gcsx"
Expand Down Expand Up @@ -421,6 +422,10 @@ const ConflictingFileNameSuffix = "\n"

// LOCKS_REQUIRED(d)
func (d *dirInode) LookUpChild(ctx context.Context, name string) (*Core, error) {
if index := strings.LastIndex(name, "/"); index != -1 && len(name) - index > 255 {
return nil, syscall.ENAMETOOLONG // TODO: fuse.ENAMETOOLONG
}

// Is this a conflict marker name?
if strings.HasSuffix(name, ConflictingFileNameSuffix) {
return d.lookUpConflicting(ctx, name)
Expand Down

0 comments on commit 5d0bb5c

Please sign in to comment.