Comments (11)
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
Hi Batte,
This is clearly an efsw bug. The problem is that i don't have access to any OS X 10.7 to test it, sadly my Mountain Lion VM isn't working right now.
The problem comes from what i clarify in the README.md file, this is what it says:
"FSEvents for OS X Lion and beyond in some cases will generate more actions that in reality ocurred, since fine-grained implementation of FSEvents doesn't give the order of the actions retrieved, in some cases i need to guess/aproximate the order of them."
May be you can help me a little if you send me a complete log of the events with efsw compiled as debug ( it gives some extra information for debugging ). Finder generates weird events on all OS X versions, but i don't know exactly why, they are correct, but sometimes you don't receive exactly what you can expect.
As a temporary fix you can compile efsw with the flag "EFSW_FSEVENTS_NOT_SUPPORTED", it will use the Kqueue backend instead the FSEvents backend, or you can change this function FileWatcherFSEvents::isGranular() to return always false, and it will use FSEvents without granularity. And if you are brave and wan't to take a look at the problem, the problem starts in WatcherFSEvents.cpp at line 137.
Thank you for reporting it,
i'll try to take a look at this ASAP.
from efsw.
Original comment by Batte HUCHAI (Bitbucket: bhuchai, ).
Hello,
Thank you for answering me.
For your debug logs, I compiled EFSW in debug mode (with "config=debug" instead of "config=release") but it seems to print the same thing (for the same events sequence as described in my initial post) :
[Good] With Terminal :
DIR (/Users/buchet_b/Documents/Watched/) FILE (BAR.txt) has event Delete
DIR (/Users/buchet_b/Documents/Watched/) FILE (FOO2.txt) has event Moved from (FOO.txt)
DIR (/Users/buchet_b/Documents/Watched/) FILE (TEST.txt) has event Added
DIR (/Users/buchet_b/Documents/Watched/) FILE (TEST2.txt) has event Moved from (TEST.txt)
[Bad] With Finder : (n.b. the 3rd step of my initial post is a "touch TEST.txt" done with Terminal)
DIR (/Users/buchet_b/Documents/Watched/) FILE (.DS_Store) has event Added
DIR (/Users/buchet_b/Documents/Watched/) FILE (.DS_Store) has event Modified
DIR (/Users/buchet_b/Documents/Watched/) FILE (FOO.txt) has event Moved from (BAR.txt)
DIR (/Users/buchet_b/Documents/Watched/) FILE (TEST.txt) has event Added
DIR (/Users/buchet_b/Documents/Watched/) FILE (FOO2.txt) has event Moved from (TEST.txt)
Note that I use ./lib/libefsw-static-debug.a linked to a Qt C++ project with your main.cpp example (on watched folder "/Users/buchet_b/Documents/Watched/"). Why a Qt project ? Because I would like to use EFSW for a final project which is made with Qt framework (I've actually no choice but it shouldn't be a problem).
Does it normally print others lines ?
B.
from efsw.
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
Sorry, i made a mistake, compiling as debug isn't enough, it is needed to compile with the define EFSW_VERBOSE, if you are using the premake4 file, generate the Makefiles with: premake4 gmake verbose, and then recompile.
Also, read this: https://bitbucket.org/SpartanJ/efsw/issue/5/event-sent-twice to mix Qt and efsw without problems.
Please in the next report, make the examples following the exact same actions with the same files.
Thanks for your patience!
from efsw.
Original comment by Batte HUCHAI (Bitbucket: bhuchai, ).
Sorry by advance if I made a mistake but it still seems to print the same.
I did :
iMac:efsw_project buc_b$ ./premake4 gmake verbose
Building configurations...
Running action 'gmake'...
Generating make/macosx/Makefile...
Generating make/macosx/efsw-static-lib.make...
Generating make/macosx/efsw-test.make...
Generating make/macosx/efsw-shared-lib.make...
Done.
iMac:efsw_project buc_b$ cd make/macosx/ && make config=debug
==== Building efsw-static-lib (debug) ====
FileWatcherFSEvents.cpp
Linking efsw-static-lib
==== Building efsw-test (debug) ====
Linking efsw-test
==== Building efsw-shared-lib (debug) ====
FileWatcherFSEvents.cpp
Linking efsw-shared-lib
iMac:macosx buc_b$ ls -la ../../lib/
total 8024
drwxr-xr-x 5 buc_b staff 170 26 aoû 23:17 .
drwxr-xr-x@ 16 buc_b staff 544 7 jui 00:50 ..
-rwxr-xr-x 1 buc_b staff 843976 26 aoû 23:17 libefsw-debug.dylib
-rw-r--r-- 1 buc_b staff 3041272 26 aoû 23:17 libefsw-static-debug.a
-rwxr-xr-x 1 buc_b staff 215760 6 jul 01:18 libefsw.dylib
from efsw.
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
It looks like you forgot to: make clean before building again ( it only rebuilded one file, but the file that sends this verbose notifications is not the file rebuilded, which is WatcherFSEvents.cpp ).
from efsw.
Original comment by Batte HUCHAI (Bitbucket: bhuchai, ).
Indeed, sorry about this "novice mistake" ^.^
So, for the exactly 4 steps of my initial post, I get :
Using backend: FSEvents
File descriptor limit 10240
Event in: /Users/buc_b/Documents/Watched/BAR.txt - flags: 67584
New lastRenamed: BAR.txt
Event in: /Users/buc_b/Documents/Watched/.DS_Store - flags: 69632
DIR (/Users/buc_b/Documents/Watched/) FILE (.DS_Store) has event Modified
Event in: /Users/buc_b/Documents/Watched/FOO.txt - flags: 67584
DIR (/Users/buc_b/Documents/Watched/) FILE (FOO.txt) has event Moved from (BAR.txt)
Event in: /Users/buc_b/Documents/Watched/FOO2.txt - flags: 67584
New lastRenamed: FOO2.txt
Event in: /Users/buc_b/Documents/Watched/TEST.txt - flags: 65792
DIR (/Users/buc_b/Documents/Watched/) FILE (TEST.txt) has event Added
Event in: /Users/buc_b/Documents/Watched/TEST.txt - flags: 67840
DIR (/Users/buc_b/Documents/Watched/) FILE (FOO2.txt) has event Moved from (TEST.txt)
Le programme s'est terminé subitement.
/Users/buc_b/Documents/efsw_test/efsw_test-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Debug/efsw_test.app/Contents/MacOS/efsw_test a quitté avec le code 0
Do not hesitate if you need more information/help.
from efsw.
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
Well, i recovered my OS X Lion VM and made an attempt to fix this problems, it should be working. It's probable that you'll still receive more events than expected but it's not an efsw problem, is a combination of the horrible FSEvents events reports and the aggressive file modification that Finder usually does.
Please test it and give me some report about this commit.
from efsw.
Original comment by Batte HUCHAI (Bitbucket: bhuchai, ).
OK, I'm gonna test as soon as possible.
Just a question : your advice which consists to return always FALSE in isGranular() function works well but is there some bad effects if we use it (i.e. loss of functionalities, etc.) ?
from efsw.
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
Hi Batte, you don't lost any functionality. The difference relies in the fact that i need to keep a copy of the structure of every folder, and that translates in some memory usage. But the memory usage depends on how big is the directory tree that you're watching. Calculate something like 400 KB every 1000 files, it's it something to take in consideration, but depending on the usage, this could be irrelevant or not.
from efsw.
Original comment by Batte HUCHAI (Bitbucket: bhuchai, ).
Hello,
I've just tried your commit and good news : it's working !
Indeed, for the same events sequence as described in my initial post, I get :
DIR (/Users/buc_b/Documents/Watched/) FILE (BAR.txt) has event Delete
DIR (/Users/buc_b/Documents/Watched/) FILE (.DS_Store) has event Modified
DIR (/Users/buc_b/Documents/Watched/) FILE (FOO2.txt) has event Moved from (FOO.txt)
DIR (/Users/buc_b/Documents/Watched/) FILE (TEST.txt) has event Added
DIR (/Users/buc_b/Documents/Watched/) FILE (TEST2.txt) has event Moved from (TEST.txt)
from efsw.
Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).
Excellent!
I'll close this bug as fixed, but let me know if you ever find something wrong.
Thanks for your help!
from efsw.
Related Issues (20)
- Filename passed without extension HOT 1
- Cannot track symlinked file in Linux HOT 10
- Bazel Building HOT 1
- On MacOS, actions happening shortly after starting watcher are not reported HOT 19
- CMake multi config issue HOT 2
- Support Windows long path aware HOT 4
- Check Return Code and Allow Buffer Customization in `ReadDirectoryChangesW()` Function HOT 1
- Paranoid exit code? HOT 2
- MacOS build on server HOT 1
- [Bug] Crash while thread running after FileWatcherInotfiy destructed. HOT 16
- Premake5 macosx after gmake2 ... [CI Server] HOT 1
- Last modified file remembered and failing to fire event under Windows HOT 5
- Premake links in ReadMe is dead HOT 1
- FSEventStreamScheduleWithRunLoop has been deprecated in MacOS 13 HOT 3
- Nested template syntax breaks LEGACY builds HOT 3
- Generic file watcher doesn't report new directories on network drives HOT 2
- memory leak doubt and thread conflict HOT 2
- Cross building on macOS may cause `EFSW_FSEVENTS_NOT_SUPPORTED` incorrectly defined HOT 2
- Incorrect move events reported for simultaneous file moves across monitored subdirectories on Windows HOT 9
- Warning C4834 in Log.cpp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efsw.