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
This commit is contained in:
parent
74b723d765
commit
93939961f5
@ -299,7 +299,6 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f
|
|||||||
}
|
}
|
||||||
// Decrypted directory entries
|
// Decrypted directory entries
|
||||||
var plain []fuse.DirEntry
|
var plain []fuse.DirEntry
|
||||||
var errorCount int
|
|
||||||
// Filter and decrypt filenames
|
// Filter and decrypt filenames
|
||||||
for i := range cipherEntries {
|
for i := range cipherEntries {
|
||||||
cName := cipherEntries[i].Name
|
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",
|
tlog.Warn.Printf("OpenDir %q: invalid entry %q: Could not read .name: %v",
|
||||||
cDirName, cName, err)
|
cDirName, cName, err)
|
||||||
fs.reportMitigatedCorruption(cName)
|
fs.reportMitigatedCorruption(cName)
|
||||||
errorCount++
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cName = cNameLong
|
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",
|
tlog.Warn.Printf("OpenDir %q: invalid entry %q: %v",
|
||||||
cDirName, cName, err)
|
cDirName, cName, err)
|
||||||
fs.reportMitigatedCorruption(cName)
|
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
|
continue
|
||||||
}
|
}
|
||||||
// Override the ciphertext name with the plaintext name but reuse the rest
|
// 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])
|
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
|
return plain, status
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user