mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-11-04 06:15:02 -05:00
macOS reaches the writable disk twice. /Users/me and /System/Volumes/Data/Users/me are the same directory joined by a firmlink, realpath does not resolve firmlinks, and FSEvents subscribes to exactly one of the two. Spacedrive resolves a source root through its volume's mount point, so the spelling it asks for is the one that does not work. The outbound half of that translation existed: watchable_spelling rewrote the path handed to FSEvents. The inbound half did not, so events came back in FSEvents' spelling and never matched a watched root. find_by_path missed and the watcher built a second tree beside the one the walk had already built. Both halves now live in one module. /usr/share/firmlinks publishes the mapping, so a watch resolves to a set of subscriptions, each carrying the prefix its events are rewritten back to. Above the watcher edge only one spelling exists, and the two calls to watchable_spelling in the ephemeral handler collapse back to comparing paths. A watch on the whole Data volume fans out. /System/Volumes/Data has no short spelling of its own, so it subscribes to each firmlink beneath it instead; this is Macintosh HD, which received nothing at all before. a_watch_on_the_long_spelling_delivers_under_it drives a real watch end to end. Both halves were checked by removing them: without the outbound rewrite nothing arrives, without the inbound one the path arrives in the wrong spelling. It watches a directory under $HOME because a temp directory will not do — /var/folders is reached through a symlink rather than a firmlink and FSEvents refuses its resolved spelling, which is a separate quirk.