From 18befda0e6f1a690fa000951df8f9a4a61daebbb Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 29 May 2021 16:44:38 +0200 Subject: [PATCH] fusefrontend: list "." and ".." in dir entries Fixes xfstests generic/401 --- internal/fusefrontend/node_dir_ops.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/fusefrontend/node_dir_ops.go b/internal/fusefrontend/node_dir_ops.go index ddffea6..001c23a 100644 --- a/internal/fusefrontend/node_dir_ops.go +++ b/internal/fusefrontend/node_dir_ops.go @@ -161,13 +161,12 @@ func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) { defer syscall.Close(parentDirFd) // Read ciphertext directory - var cipherEntries []fuse.DirEntry fd, err := syscallcompat.Openat(parentDirFd, cDirName, syscall.O_RDONLY|syscall.O_DIRECTORY|syscall.O_NOFOLLOW, 0) if err != nil { return nil, fs.ToErrno(err) } defer syscall.Close(fd) - cipherEntries, err = syscallcompat.Getdents(fd) + cipherEntries, specialEntries, err := syscallcompat.GetdentsSpecial(fd) if err != nil { return nil, fs.ToErrno(err) } @@ -184,6 +183,8 @@ func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno) { } // Decrypted directory entries var plain []fuse.DirEntry + // Add "." and ".." + plain = append(plain, specialEntries...) // Filter and decrypt filenames for i := range cipherEntries { cName := cipherEntries[i].Name