Repository: syncthing/syncthing (language: go)

Issue:
When socket files are in a folder that needs to be synced on linux, some files were not synced until the socket files were removed
### What happened?

OS Fedora 41 
folder to sync is a subfolder in user home containing some socket files of gpg agent (socket files mistakenly got there).


some other  files which were recently changed were randomly not synced until the socket files were removed. 

rescanning and restarting syncthing didn't help.


after removing the socket files the sync process sync all remaining files on 1st attempt.


my assumption is: when the socket files were accessed by the (not so randomly choosing) syncing process the syncing process crashed silently. 

the missing files would have been accessed by the syncing process in the order after the  socket files. since the process crashed silently the files could not get synced. 

- just an assumption -

### Syncthing version

v1.28.0

### Platform & operating system

Linux amd64

### Browser version

Firefox

### Relevant log output

_No response_


Discussion / hints:
Can you give an example of a file, or a way to create one, to reproduce this issue?
@calmh: I sent you an email.

Fix patch:
diff --git a/lib/scanner/walk.go b/lib/scanner/walk.go
index 4f916329bde..8cc719b102c 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 {


Test patch: