From 79ef57d0eacffca6953b3fcf1d520996c6c74065 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 19 Dec 2024 08:27:53 +0100 Subject: [PATCH] fix(scanner): continue walk after special files (fixes #9872) (#9877) We must skip unix sockets, fifos, etc when scanning as these are not filetypes we can handle. Currently we return a "bug" error, which results in the walk being aborted and the rest of the tree being essentially invisible to Syncthing. Instead, just ignore these files and continue onwards. This might well be #9859 as well but I can't confirm. --- lib/scanner/walk.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/scanner/walk.go b/lib/scanner/walk.go index 4f916329b..8cc719b10 100644 --- a/lib/scanner/walk.go +++ b/lib/scanner/walk.go @@ -392,9 +392,13 @@ func (w *walker) handleItem(ctx context.Context, path string, info fs.FileInfo, case info.IsRegular(): return w.walkRegular(ctx, path, info, toHashChan) - } - return fmt.Errorf("bug: file info for %v is neither symlink, dir nor regular", path) + default: + // A special file, socket, fifo, etc. -- do nothing but return + // success so we continue the walk. + l.Debugf("Skipping non-regular file %s (%s)", path, info.Mode()) + return nil + } } func (w *walker) walkRegular(ctx context.Context, relPath string, info fs.FileInfo, toHashChan chan<- protocol.FileInfo) error {