From 93939961f57e881f2b82293aa8749ea6f1ba6180 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 3 Nov 2019 20:12:05 +0100 Subject: fusefrontend: don't return EIO on directory with corrupt file names This was meant as a way to inform the user that something is very wrong, however, users are hitting the condition on MacOS due to ".DS_Store" files, and also on NFS due to ".nfsXXX" files. Drop the whole thing as it seems to cause more pain than gain. Fixes https://github.com/rfjakob/gocryptfs/issues/431 --- internal/fusefrontend/fs_dir.go | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'internal/fusefrontend/fs_dir.go') diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index 773e389..ad35f93 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -299,7 +299,6 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f } // Decrypted directory entries var plain []fuse.DirEntry - var errorCount int // Filter and decrypt filenames for i := range cipherEntries { cName := cipherEntries[i].Name @@ -326,7 +325,6 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f tlog.Warn.Printf("OpenDir %q: invalid entry %q: Could not read .name: %v", cDirName, cName, err) fs.reportMitigatedCorruption(cName) - errorCount++ continue } cName = cNameLong @@ -339,12 +337,6 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f tlog.Warn.Printf("OpenDir %q: invalid entry %q: %v", cDirName, cName, err) fs.reportMitigatedCorruption(cName) - if runtime.GOOS == "darwin" && cName == dsStoreName { - // MacOS creates lots of these files. Log the warning but don't - // increment errorCount - does not warrant returning EIO. - continue - } - errorCount++ continue } // Override the ciphertext name with the plaintext name but reuse the rest @@ -353,13 +345,5 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f plain = append(plain, cipherEntries[i]) } - if errorCount > 0 && len(plain) == 0 { - // Don't let the user stare on an empty directory. Report that things went - // wrong. - tlog.Warn.Printf("OpenDir %q: all %d entries were invalid, returning EIO", - cDirName, errorCount) - status = fuse.EIO - } - return plain, status } -- cgit v1.2.3