From 3a5a783b54a913294658041f22066e0618ee91f3 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 5 Sep 2017 21:47:05 +0200 Subject: [PATCH] macos: don't throw IO errors because of .DS_Store files MacOS creates lots of these files, and if the directory is otherwise empty, we would throw an IO error to the unsuspecting user. With this patch, we log a warning, but otherwise pretend we did not see it. Mitigates https://github.com/rfjakob/gocryptfs/issues/140 --- internal/fusefrontend/fs_dir.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index c87cc02..0252c2a 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -7,6 +7,7 @@ import ( "io" "os" "path/filepath" + "runtime" "sync" "syscall" @@ -324,6 +325,11 @@ func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, f if err != nil { tlog.Warn.Printf("OpenDir %q: invalid entry %q: %v", cDirName, cName, err) + if runtime.GOOS == "darwin" && cName == ".DS_Store" { + // MacOS creates lots of these files. Log the warning but don't + // increment errorCount - does not warrant returning EIO. + continue + } errorCount++ continue }