emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
5.01k stars 326 forks source link

Exclude items with poll_monitor not considered #66

Closed walterdolce closed 9 years ago

walterdolce commented 9 years ago

Hi @emcrisostomo. As per #62, I was trying a different monitor but it seems that by using the ones below the -e parameter items are not taken into account.

When I launch:

> fswatch  -l 0.1 -r -e \.git/ -x ./ -m kqueue_monitor 

or:

> fswatch  -l 0.1 -r -e \.git/ -x ./ -m poll_monitor 

And I modify a file in the same directory, I get notified about what's in the .git/ folder as well. I also tried by not escaping the dot (.) in the .git/ parameter item just to double check and I get the same result (of course I'd say as it requires a regexp).

Is the excluded items feature something specifically related to FSEvents not supported by the ones above? Do kqueue_monitor or poll_monitor require different param settings to exclude items?

Version in use is fswatch 1.4.5

Thank you!

emcrisostomo commented 9 years ago

Hi @walterdolce,

This looks like a bug: every monitor should honour the exclusion/inclusion patterns. I'll have a look at it ASAP.

emcrisostomo commented 9 years ago

Hi @walterdolce,

There's a bug in the poll_monitor, tomorrow I'll test it and will release a fix.

The kqueue_monitor, on the other hand, is working correctly. The kqueue API is sending an update notification for the /path/to/.git: since the exclusion filter is .git/, the final / does not match the path and the record is correctly notified.

Cheers,

Enrico.

walterdolce commented 9 years ago

Ah! Thanks for this @emcrisostomo .

So to exclude a directory and its content one should not put the ending forward slash?

In the mean time though, I look forward for the fix as I will probably use the poll_monitor for portability reasons (on this, would you also recommend it?).

Thanks!

walterdolce commented 9 years ago

Hi @emcrisostomo . Is there a way I could contribute on this?

Note that I'm not a C/C++ developer but I could start at any time given some guidance :-P

Thanks!

emcrisostomo commented 9 years ago

Hi @walterdolce,

Sorry for the belated answer and thanks for the offer. In this case, it was not complexity, but available time the reason to delay this.

I've just pushed 1.4.5.2 to the repository, and I'm preparing MacPorts and Homebrew package updates. I'm going to close this issue.

Now, to answer your questions: yes, regular expressions are used and directories do not contain a final path separator character. Hence, to filter them out, you should not add it, otherwise the event path will not be matched.

Cheers.

walterdolce commented 9 years ago

Hi @emcrisostomo . Thank you so much for this.

Guess Homebrew package is not yet updated as I have brew upgrade fswatch and the exclusion when using poll_monitor still doesn't work.

Will wait for that and let you know.

Cheers!

emcrisostomo commented 9 years ago

Hi @walterdolce,

Yes, you've got to wait for their build machines to prepare the package. Here is the status of the 1.4.5.2 package and as you can see the package build is OK and it's in queue for merging.

Cheers.

walterdolce commented 9 years ago

Hi @emcrisostomo

Thank you for the link above. I'm afraid though that exclusions are still not working.

Following are the commands I launched. All of them were failing:

> fswatch  -l 0.1 -r -e .git -x ./ -m poll_monitor
> fswatch  -l 0.1 -r -e \.git -x ./ -m poll_monitor

> fswatch  -l 0.1 -r -e ./.git -x ./ -m poll_monitor
> fswatch  -l 0.1 -r -e ./.git/ -x ./ -m poll_monitor

> fswatch  -l 0.1 -r -e \./\.git -x ./ -m poll_monitor
> fswatch  -l 0.1 -r -e \./\.git/ -x ./ -m poll_monitor

> fswatch  -l 0.1 -r -e .git/ -x ./ -m poll_monitor
> fswatch  -l 0.1 -r -e \.git/ -x ./ -m poll_monitor

Note that I've also sent the path with final forward slashes, just to double check. I have upgraded fswatch via brew upgrade fswatch right after I saw the build was finished and green. So I'm assuming that I'm using the latest version.

On versioning specifically, note that fswatch --version doesn't show up the full version scheme used for fswatch (that is, 1.4.5.3). But only the MINOR.MAJOR.PATCH as defined in semver.org. So I'm not sure which specific version I have. I'd assume the latest though.

Thanks!

emcrisostomo commented 9 years ago

Hi @walterdolce, I made a test and it works here:

% ./src/fswatch -r -e .git -x ~/temp -m poll_monitor

and I see no output when I touch files into ~/temp/.git.

if you don't see 1.4.5.3, then I guess you don't have it. The version is included into the sources so I see no way it could be otherwise. You should see:

% ./src/fswatch --version
fswatch 1.4.5.3
Copyright (C) 2014, Enrico M. Crisostomo <enrico.m.crisostomo@gmail.com>.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Enrico M. Crisostomo.

Could you download the release source tarball and build it yourself?

If there's some problem with Homebrew and the 4-digit versioning scheme I use, I guess I'll think about changing it.

walterdolce commented 9 years ago

Hi @emcrisostomo .

Yes. I can definitely confirm that after manually installing it from the above it's working as expected. And I can also confirm that fswatch --version returns what you posted in the output above.

Thank you so much!

Have a nice weekend.

Best, Walter

emcrisostomo commented 9 years ago

Hi @walterdolce,

Cool, thanks for confirming this. Have a nice weekend too.

Cheers,

Enrico

ihorman commented 7 years ago

Hi Enrico,

First of all I want to say thanks for the application, it's really nice. Looks like the regex in --exclude directive this doesn't work

I am running an application, version 1.9.3, in this way:

fswatch --monitor=poll_monitor --exclude='.zfs' -r /mymountedfolder/

when I do strace -p <PID of fswatch> I still can see it makes

lsstat ('/mymountedfolder/.zfs/lotsofdata-that-need-to-be-excluded')

the problem in my case I have 21 million of files and I need to exclude that paths to make this polling not running forever, but looks like this doesn't work for me for some reason.

emcrisostomo commented 7 years ago

Hi @ihorman,

This definitely looks like a different issue. Furthermore, this one is marked as close. Would you please open a new one? I'll have a look at it in the next few days.

emcrisostomo commented 7 years ago

Opened #151

ihorman commented 7 years ago

Dear Enrico,

Thank you!

Best Regards, Ihor

2016-12-05 10:59 GMT+01:00 Enrico Maria Crisostomo <notifications@github.com

:

Opened #151 https://github.com/emcrisostomo/fswatch/issues/151

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/emcrisostomo/fswatch/issues/66#issuecomment-264812456, or mute the thread https://github.com/notifications/unsubscribe-auth/AF9qCWfkDogFktaQQmf6Eiogno3b30Tbks5rE-CXgaJpZM4C0n9B .

-- Best wishes and regards Ihor Kolodyuk