Skip to content

Conversation

benitogf
Copy link

No description provided.

@benitogf benitogf mentioned this pull request May 14, 2018
@lpsmith
Copy link
Owner

lpsmith commented May 16, 2018

Pretty sure the change to getMessage is incorrect, as a buffer can consist of multiple inotify messages

@lpsmith
Copy link
Owner

lpsmith commented May 24, 2018

It's not clear to me what your example code is supposed to accomplish, here.

You might be interested in my LogFollower.hs example. It's basically an implementation of tail -f that also integrates a log-rotation scheme. The log rotation scheme is one of my own creation, in the "works for me" category. It is very reliable but it also depends upon the correctness of the external programs that manipulate that file and filename (which I have full control over).

Perhaps you could remove the log rotation mechanism, and use that as part of your pull request.

@benitogf
Copy link
Author

The example is meant to be merely illustrative of the module usage, and also provide something that runs on cabal test I reckon that is not a "real world" usage as your example above, but this seems to be common ex: here, there

@lpsmith
Copy link
Owner

lpsmith commented May 25, 2018

Ok, I see what you'd like to do, I think. I might be able to help you along a little bit, if you'd like.

@benitogf
Copy link
Author

yep what would be awesome 🛩

@benitogf
Copy link
Author

something that I would like to test: fsnotify/fsnotify#92 (comment) same issue will happen here due to vim events after writing a file we will stop getting events

@lpsmith
Copy link
Owner

lpsmith commented May 25, 2018

Ok, it's pretty easy to create a simple "inotify dump" type programs, I created one myself which I just might be able to find. (Though I simply displayed the event flags field in hex, and didn't bother making it look super nice.)

Regarding the issue you linked, that gets into a huge can of worms regarding file system semantics and the exact system calls that other programs use to manipulate a posix-ish file system. On ext4, I can totally rewrite the contents of a file without generating anything more than a move overwrite type of event, and I can be almost as clean on filesystems without O_TMPFILE, such as ZFS. So that whole issue you linked to seems ill-posed to me.

@benitogf
Copy link
Author

Agreed that the issue gets complex if you start digging into it, found threads such as this that clearly exposes points as yours, and solutions such as implementing a posix filesystem using sqllite, or going though sqllite code since it: "competes against fopen not rdbms" which it's a suprising statement for me. Anyhow getting around the quirks of other programs (editors and such) way to handle files and still using just inotify imho remains a simpler (and perhaps naive) solution to monitor fs events. Hope that eventually handling this kind of events would be a must for any program that deals with fs, think that we are going in that direction with fanotify

@lpsmith
Copy link
Owner

lpsmith commented May 29, 2018

Yes, fanotify may well be a better, easier way to go, depending on your use case. Another example of something I've used this binding for, was for signaling javascript reloads in my react-comments backend for a previous incarnation of Facebook's react tutorial.

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

Successfully merging this pull request may close these issues.

2 participants