Skip to content
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

inotifywait gets just 'ATTRIB' #2

Open
hamann opened this issue Sep 25, 2015 · 3 comments
Open

inotifywait gets just 'ATTRIB' #2

hamann opened this issue Sep 25, 2015 · 3 comments

Comments

@hamann
Copy link

hamann commented Sep 25, 2015

I set up a vagrant vm with your vagrant notify-forwarder plugin, host is a Mac OS X (10.10.5), guest is debian jessie. In the vm there's an app running, waiting for some fs events by calling inotifywait => https://github.com/synrc/fs/blob/master/src/sys/inotifywait.erl#L10
If I open/edit some file on the host nothing happens (should compile something).
I played a bit, started inotifywait /vagrant and edited, deleted, created files, but all I can see is

vagrant@db24-phoenix /vagrant ❯❯❯ while true; do inotifywait /vagrant -r; done                                                               
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/ ATTRIB mix.exs
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/ ATTRIB mix.exs
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/ ATTRIB mix.lock
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/script/ ATTRIB .vagrant_provision.sh.swp
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/.git/ ATTRIB FETCH_HEAD
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/.git/ ATTRIB FETCH_HEAD
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.

If I do something inside the vm in /vagrant inotifywait shows

Watches established.
/vagrant/ ATTRIB,ISDIR test
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/ CREATE foo
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/ DELETE foo
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/vagrant/ ATTRIB foo

So what's happening here? Is notify-forwarder not able to forward the correct event types?

There's another app running (https://github.com/brunch/brunch), which responds to events from notify-forwarder, but I did not dig deeper since it's doing its job ;)

@hamann
Copy link
Author

hamann commented Sep 25, 2015

inotifywatch also just shows 'attrib' after editing a file

vagrant@db24-phoenix /vagrant ❯❯❯ inotifywatch /vagrant -v -r
Establishing watches...
Setting up watch(es) on /vagrant
OK, /vagrant is now being watched.
Total of 665 watches.
Finished establishing watches, now collecting statistics.
^Ctotal  attrib  filename
1      1       /vagrant/script/

@mhallin
Copy link
Owner

mhallin commented Sep 28, 2015

This is unfortunately a limitation of the simple way I simulate events - the file is just touched with a new mtime. notify-forwarder is more of a tool that forwards that some file event has happened, rather than the specific event.

I guess a few of the other events could be properly forwarded, but CREATE/DELETE would be hard to simulate without injecting events directly into the kernel, which would probably require a kernel module. If anyone know of a simpler way to inject inotify events, please let me know. :-)

@jchook
Copy link

jchook commented Feb 4, 2018

Thanks for the explanation @mhallin.

We should probably mention this front-and-center on the README.md as right now it reads as though the proper event will be forwarded.

A simple tool for forwarding file system notifications from one host to another, possibly remapping the path in the process. Useful when running a reloading build system on one machine and editing files on another, or over shared folders to a VM.

Many reloading build systems will not respond to attrib events without adjusting their parameters.

For example, use iwatch -e attrib to respond to attrib events with iwatch. Some software such as entr do not support this at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants