-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shouldn't ignore prevent symlink errors? #363
Comments
Summary: the warnings mean you need to rethink the project - mostly because of OSX limitations. ("Earlier level" here would pretty much mean hacking OSX internals - probably impossible). Ignoring ( Events themselves come from the operating system, so Guard can't really control that. (Except of course in polling, but polling is usually slow). Basically the problem is OSX. OSX adapter (rb-fsevent) watches directories recursively, period. So But, if you want to watch the project root directory, on OSX you're forced to watch everything. Some details here: |
I get it so far, I see why the architecture must see events and then filter them later, and thank you for the explanation. But wouldn't it work to have the warning suppressed if the "ignore" feature is turned on for the directory triggering the warning? |
In case it helps, first see this: guard/guard#811 (comment) The answer is "no", because of ambiguity. If you have
And what if there are symlinks between 'a' and 'c'? Listen would have to be either inconsistent or incredibly intelligent to figure out what to report. And Listen monitors files and not paths, while users expect paths, so Listen does some magic to "preserve" what the user watched. There are also "filesystem loops", which could hang Listen with an infinite loop. The best way of thinking is: "the operating system watches directory recursively (blame Apple), and Listen translates multiple events into a single 'reasonable' event'. The reason Listen can't be smarter with symlinks is because of current OSX implementation limits. The 'ignore' feature is a high-level one, to avoid temp files, log files, backup files - and to optimize things when polling is used. The warning is there to protect novice users from getting stuck with extremely frustrating and hard to debug problems. The project should be reorganized to avoid the warning, because philosophically it's the right thing to do. It's not that symlinks are "bad", it's just that watching the same physical directories multiple times makes no sense. Yes, it's convenient to use symlinks for editing and organizing a project, but it doesn't make sense to WATCH symlinked directories. And the OSX adapter simply doesn't allow NOT WATCHING subdirectories, because it's recursive. |
I'm planning to solve this with: #381 Basically, once Listen has an internal database of symlinks, you should be able to watch symlinks properly. |
I've read the helpful documentation about how symlinks cause warnings about "directory already being watched". This is noise in my guard reporting, so I investigated how to avoid the warnings. Having considered all the options, I think symlinks are pretty useful in projects (e.g. we avoid duplicating assets in our directory by symlinking those assets between the modules that need those assets, so if we change our logo it changes on the Web and in the client).
The 'ignore' feature seemed perfect, except for the clear documentation that it doesn't work, because "events are only filtered after they are fired". Why wouldn't it be considered a useful feature in 'ignore' for 'ignore' to act at an earlier level? Or that 'ignore' would filter this duplicate directory warning as well as filtering events after they are fired?
The text was updated successfully, but these errors were encountered: