-
-
Notifications
You must be signed in to change notification settings - Fork 690
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inotify: dont fire modify event on IN_CLOSE_WRITE
- Loading branch information
Showing
1 changed file
with
0 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But
IS_CLOSE_WRITE
is a very important event – surely the right thing to do here is to map it to a new event type?ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But is closing a file modifying it though? If you map IS_CLOSE_WRITE like this, it will report the file is modified when it isn't actually modified.
ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening a file for writing always modifies the file in the sense that it'll update its timestamp and make a new inode.
ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure mtime is only update when you actually write something. That's why it went with removing it.
ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
mtime
field is updated every time you flush changes to disk. Now, when the file is closed (which is an interesting event for many programs), theIN_CLOSE_WRITE
event is issued.ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't respond to this event, users of the library can't know if a file was closed, usually the trigger for starting to do some processing.
ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but before this commit it wasn't possible to respond to that either. It was mapped a to modified event, that looked like a normal modified event and that you would have already gotten from a previous
IN_MODIFIED
event. I don't understand how this commit changes anything.ce92680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit doesn't change anything, that is true – I just saw it disappearing altogether and wanted to investigate where it went and why it wasn't replaced by a proper implementation. By the way, I made a pull request that tries to implement it. Untested though.
Ultimately, I decided to just use the
subprocess
module to poll frominotifywait
.