Ignore everything except /X pattern still scans everything

Hi. I know this question has already been asked here already, but the resulting thread and linked pull request suggests that everything should work already as is.

So here’s my .stignore file:

!/.themes
!/.mozilla/firefox/lbcb60lw.default-release/chrome
!/.local/share/gnome-shell/extensions
*

I want to ignore everything in my home folder and sync the folders from the top 3 lines. However, when file watchers are enabled, I get this warning: error while traversing /home/foo/bar/some_restricted_folder: permission denied

I was under the impression, that since my include patterns start with / it should not scan anything else, and yet it does. Is this a regression, or am I doing something wrong?

Thanks!

Your deep patterns mean it doesn’t qualify, unfortunately. That is, if you said

!/.themes
!/.mozilla
!/.local
*

it would do what you expect (for those dirs), but as written above we need to scan .local and .local/share and .local/share/gnome-shell despite the rest of .local being ignored, and this exceeds the intelligence of the optimizer. (It’s not the smartest dude around.)

I would suggest not doing what you do, instead having a ~/.synced-files or something with the data you want to sync, and symlinking into that from ~/.themes etc.

I don’t mind it scanning .local, but it starts scanning other folders in my home folder as well. The restricted folder is actually in ~/Documents/work/

Yeah, the following still applies:

Concretely: Any include pattern that has any special character, including a path separator, after !/ results in everything being scanned. That was changed after what you linked in lib/ignore: Only skip for toplevel includes (fixes #6487) by imsodin · Pull Request #6508 · syncthing/syncthing · GitHub, due to Scan problem within single unignored subdirectory prevents bidirectional sync · Issue #6487 · syncthing/syncthing · GitHub.

I see, thank you. I’ll go with symlinked folder approach then

Dear Simon,

do you want to say that the hack with series of included/excluded subfolders is still relevant? I believe this bug was fixed around v1.5.0 and do not use this with the latest versions in my project.

That’s something entirely different and not relevant to the topic here.