GNOME Bugzilla – Bug 742849
inotify: send paired events to both sides
Last modified: 2018-05-24 17:22:44 UTC
A file monitor on a directory could be prevented from seeing incoming moves of files simply because of the existence of another unrelated file monitor in the same process watching the source directory of the move. This happens even if the affected monitor does not use the SEND_MOVED flag (although the 'unrelated' one must be using it). This works correctly, and reports both CREATED and DELETED events: def show_event(mon, child, other, event): print event m0 = Gio.File.new_for_path('/a').monitor_directory (0, None) m0.connect('changed', show_event) but if this is also added: m1 = Gio.File.new_for_path('/b').monitor_directory (Gio.FileMonitorFlags.SEND_MOVED, None) then m0 will fail to report CREATED events for moves from /b to /a. Let's fix that to avoid the 'spooky action at a distance' effect.
Created attachment 294422 [details] [review] inotify: send paired events to both sides
Review of attachment 294422 [details] [review]: This doesn't do the correct thing in the event that the pair lands on the same monitor -- then we get a MOVED and an extra CREATED. I'm currently adding new API to GFileMonitor to help us deal with renames more symmetrically. I'll update this when I'm done with that.
I've added a test for this to testfilemonitor.c - not clear to me if I am seeing the expected sequence of events here or not.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/981.