After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 742849 - inotify: send paired events to both sides
inotify: send paired events to both sides
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-01-13 13:05 UTC by Allison Karlitskaya (desrt)
Modified: 2018-05-24 17:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
inotify: send paired events to both sides (1.60 KB, patch)
2015-01-13 13:05 UTC, Allison Karlitskaya (desrt)
needs-work Details | Review

Description Allison Karlitskaya (desrt) 2015-01-13 13:05:17 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.
Comment 1 Allison Karlitskaya (desrt) 2015-01-13 13:05:18 UTC
Created attachment 294422 [details] [review]
inotify: send paired events to both sides
Comment 2 Allison Karlitskaya (desrt) 2015-01-13 13:37:57 UTC
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.
Comment 3 Matthias Clasen 2015-08-21 04:42:05 UTC
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.
Comment 4 GNOME Infrastructure Team 2018-05-24 17:22:44 UTC
-- 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.