Skip to content

fs watcher silently drops all events for folders under a macOS synthetic.conf symlink (EvalSymlinks'd root vs. unresolved FSEvents paths) #10953

Open

Description

@coreyml

What happened?

On macOS, a folder whose path goes through a synthetic.conf root symlink (e.g. /data2 → /System/Volumes/Data/data2) never receives filesystem watcher events. Changes are only picked up by the periodic full rescan (up to rescanIntervalS late). No error is reported anywhere: folder watchError is empty, and nothing is logged even with fs and watchaggregator at DEBUG (only No tracked events, waiting for new event.).

Steps to reproduce

  1. /etc/synthetic.conf contains data2<TAB>System/Volumes/Data/data2, reboot. /data2 is now a root-level symlink to /System/Volumes/Data/data2.
  2. Add a folder with path /data2/test, watcher enabled, fsWatcherDelayS=1.
  3. Create a file in it.

Expected: the file is in the index within a few seconds. Actual: /rest/db/file still says "No such object in the index" after 20+ seconds; only a manual/periodic scan picks it up.

Control, same Syncthing instance, temporary unshared folders created side by side:

folder path new file indexed via watcher
~/test within 5 s
/data2/test not after 20 s
/System/Volumes/Data/data2/test (real path configured directly) not after 20 s

Pausing/resuming the folder (restarting the watcher) makes no difference.

Cause (from reading the code)

watchPaths in lib/fs/basicfs_unix.go resolves the root with filepath.EvalSymlinks, so roots is ["/System/Volumes/Data/data2/test"]. But FSEvents reports event paths with the /data2/... prefix. I verified this with a minimal FSEvents program (FSEventStreamCreate + kFSEventStreamCreateFlagFileEvents): whether it watches /data2/test or /System/Volumes/Data/data2/test, every event arrives as /data2/test/<file>.

So in Watch, absShouldIgnore → unrootedChecked(absPath, roots) fails for every event and returns true, and the event is dropped silently at the filter stage. That's why there is no "event outside of the filesystem root" error either.

This is roughly the reverse of #5043: resolving symlinks fixed the case where the backend reports resolved paths, but macOS synthetic root symlinks are reported unresolved.

Possible fix

Accept both forms, e.g. in watchPaths return roots containing the evaluated root and, when it differs, f.root as well (unrootedChecked already iterates over multiple roots).

watchPaths is byte-identical in v2.1.5, v2.1.7 and current main.

Syncthing version

v2.1.5 (Homebrew; code path unchanged in v2.1.7 / main)

Platform & operating system

macOS 27.0.1, arm64 (Apple Silicon)

Relevant log output

# fs + watchaggregator at DEBUG, after pausing/resuming the folder and creating a file in it (paths anonymized):
basic /data2/test Watch . Matcher/[]@0x... false <nil>
Started filesystem watcher (folder.id=...)
aggregator/"..." (...): No tracked events, waiting for new event.
# (nothing else; the file is never picked up until the next rescan)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions