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.
This commit is contained in:
Jakob Borg 2024-12-19 08:27:53 +01:00 committed by GitHub
parent 8bd6bdd397
commit 79ef57d0ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {