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 658491 - new subscriptions can report old events from an existing directory watch
new subscriptions can report old events from an existing directory watch
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
2.28.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-09-07 17:23 UTC by Peter Clifton
Modified: 2018-05-24 13:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Peter Clifton 2011-09-07 17:23:46 UTC
I've been having some issues with file-change monitoring, where I hook up a GFileMonitor to a file just after having changed it on disk. This only occurs in the case where a second monitor exists on the directory in question. (In this case, left hanging around due to a possible bug in the GTK file-chooser).

It appears that the GIO backend code has a bit of a race, in that it can queue up events for a directory - then process them at some later time (after my new subscription is added).

The OLD events match against the new subscription, and are dispatched - despite the events predating the subscription.

Should adding a new subscription force processing of any events up to that point (before adding the new subscription), or would this be something that could be handled by looking at the timestamp on the events?
Comment 1 Alexander Larsson 2011-09-07 19:10:25 UTC
Inotify events look like:
           struct inotify_event {
               int      wd;       /* Watch descriptor */
               uint32_t mask;     /* Mask of events */
               uint32_t cookie;   /* Unique cookie associating related
                                     events (for rename(2)) */
               uint32_t len;      /* Size of name field */
               char     name[];   /* Optional null-terminated name */
           };

No timestamp here, so it seems that we have to read out all the current events when we add another subscription and save the timestamp so that we know not to send it to the new monitor when we later process it.
Comment 2 GNOME Infrastructure Team 2018-05-24 13:20:27 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/446.