inotify: Fix handling of paired events for atomic replace

After the big file monitoring rewrite, we only put the IN_MOVED_FROM event
in the queue for such pairs. It matches INOTIFY_DIR_MASK and thus we call
ip_dispatch_event on it, but that function was filtering it out because
the filename in the 'from' event is the one of the temp file, not the
one we are monitoring. That name is in the 'to' event, so compare it as
well, and let the event passin that case.

There is another instance of this check in glocalfilemonitor.c, which is
corrected here as well.

https://bugzilla.gnome.org/show_bug.cgi?id=751358
This commit is contained in:
Matthias Clasen 2015-08-19 07:10:01 -04:00
parent 780b48c4cd
commit ac78d14125
2 changed files with 4 additions and 3 deletions

View File

@ -344,7 +344,8 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms,
g_assert (!child || is_basename (child)); g_assert (!child || is_basename (child));
g_assert (!rename_to || is_basename (rename_to)); g_assert (!rename_to || is_basename (rename_to));
if (fms->basename && (!child || !g_str_equal (child, fms->basename))) if (fms->basename && (!child || !g_str_equal (child, fms->basename))
&& (!rename_to || !g_str_equal (rename_to, fms->basename)))
return TRUE; return TRUE;
g_mutex_lock (&fms->lock); g_mutex_lock (&fms->lock);
@ -408,7 +409,6 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms,
other = g_local_file_new_from_dirname_and_basename (fms->dirname, rename_to); other = g_local_file_new_from_dirname_and_basename (fms->dirname, rename_to);
g_file_monitor_source_file_changes_done (fms, rename_to); g_file_monitor_source_file_changes_done (fms, rename_to);
g_print ("send %s %s\n", child, g_file_get_path (other));
g_file_monitor_source_send_event (fms, G_FILE_MONITOR_EVENT_MOVED, child, other); g_file_monitor_source_send_event (fms, G_FILE_MONITOR_EVENT_MOVED, child, other);
g_object_unref (other); g_object_unref (other);
} }

View File

@ -463,7 +463,8 @@ ip_event_dispatch (GList *dir_list,
*/ */
if (sub->filename && if (sub->filename &&
event->name && event->name &&
strcmp (sub->filename, event->name)) strcmp (sub->filename, event->name) &&
(!event->pair || !event->pair->name || strcmp (sub->filename, event->pair->name)))
continue; continue;
/* If the subscription has a filename /* If the subscription has a filename