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
Ignored symlinks cause original files to be skipped? #508
Comments
That's super weird, thanks for the short reproduction! |
Okay, this is quite odd but annoyingly I
which are directly from the notify crate. When I run your example with z symlinked, I only get these events:
which get correctly filtered off. When I instead symlink a, I get the same events but for /home/code/rust/foo/a/main.ts However, using
which is curious. |
With
and what inotifywatch watches:
The latter watches relative paths and the former absolute but I think that's irrelevant; something that is interesting is that inotifywatch doesn't add a watch on The other glaring difference is the set of events that are being watched. Notable watchexec is missing ...and yet, if I get inotifywatch to watch the paths watchexec does, with the set events watchexec asks for, I get the correct behaviour still:
It's also doing it if I use absolute paths. I am confused. |
As a workaround, polling mode does work. Also watchexec shouldn't even be watching |
@passcod one workaround I found, perhaps simpler is: at least for my case, adding multiple events on |
I am facing a similar issue in nrwl/nx#19312. It is also related to ignoring files that have a symlink originating from I found that using fs::canonicalize helps follow the symlink out of Ideally, the diff --git a/notify/src/inotify.rs b/notify/src/inotify.rs
index ccf8187..0a5ef86 100644
--- a/notify/src/inotify.rs
+++ b/notify/src/inotify.rs
@@ -375,7 +375,15 @@ impl EventLoop {
.into_iter()
.filter_map(filter_dir)
{
- self.add_single_watch(entry.path().to_path_buf(), is_recursive, watch_self)?;
+ self.add_single_watch(
+ entry
+ .path()
+ .to_path_buf()
+ .canonicalize()
+ .expect("canonicalize"),
+ is_recursive,
+ watch_self,
+ )?;
watch_self = false;
} I got the correct events from the notify crate:
whereas previously it was:
This would be a change to the If we wanted to fix that in watchexec, we could call Looking at the source code, I found that adding
|
Yeah, but canonicalize does I/O, which we don't really want at that point. If doing the canonicalize in notify fixes it, then perhaps the solution is to do it in watchexec, reimplementing the notify recurse logic ourselves. |
This issue is brutal for |
I'm running watchexec over a yarn workspace (the builtin build watcher I'm using was showing some limitations).
yarn workspaces are similar to cargo, in that you can have multiple sub-packages depending on each other. However, the way that works is via symlinks: if
@my-package/a
depends on@my-package/z
, then there'll be a symlinknode_modules/@my-package/z
pointing to./z
where the source code livesnode_modules
is gitignore'd, of course.And apparently, this causes any changes within
./z
to be skipped as wellnotice that I used
z
for the problematic package. This seems to only happen if alphabetical order causes node_modules to be listed first. Renamingz
tob
makes the problem go awayHere's a quick script with which I can reproduce this consistenly:
The text was updated successfully, but these errors were encountered: