Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Handle fatal watch errors gracefully #5697
Syncthing panics if it receives events outside of the folder root. I did that on the incorrect assumption that the notify library does in some form canonicalize all involved paths. However they only do that for internal housekeeping, paths passed to and received from the underlying filesystem watching interfaces are not touched. They even mention that some implementations change the path in certain situations. I have no intention to find out what all the underlying implementations do. So the sane thing is to report a verbose error if an out-of-root path is encountered and potentially stop watching. And then we can try to find out what the special case is and mitigate that in
On the gracefulness side, handling this by doing a full scan when it happens would probably be the most graceful - if it only happens very occasionally. I don't want to propose something too complex and I'm not sure how to do it without complexity, but it would be nice if we just "swallowed" the occasional oddness, but warn and stop watching if the oddness becomes overwhelming.