[tracker/tracker-1.10] libtracker-miner: Check directory updates before dropping mtime info



commit 919f3b9cd51da47b76e65c2b954d297117ed240e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 25 12:26:33 2017 +0200

    libtracker-miner: Check directory updates before dropping mtime info
    
    file_notifier_traverse_tree() has the side effect of deleting mtime data,
    as it's presumably not needed anymore, except here. Check whether the
    directory was updated before notifying of the files inside, so we can
    thoroughly check for deleted content.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786132

 src/libtracker-miner/tracker-file-notifier.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 139f44e..023ed88 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -861,6 +861,7 @@ sparql_files_query_cb (GObject      *object,
        TrackerFileNotifierPrivate *priv;
        TrackerFileNotifier *notifier;
        TrackerSparqlCursor *cursor;
+       gboolean directory_modified;
        GError *error = NULL;
        GFile *directory;
        guint flags;
@@ -883,13 +884,15 @@ sparql_files_query_cb (GObject      *object,
                g_object_unref (cursor);
        }
 
-       file_notifier_traverse_tree (notifier, data->max_depth);
        directory = priv->current_index_root->current_dir;
        flags = priv->current_index_root->flags;
+       directory_modified = file_notifier_is_directory_modified (notifier, directory);
+
+       file_notifier_traverse_tree (notifier, data->max_depth);
 
        if ((flags & TRACKER_DIRECTORY_FLAG_CHECK_DELETED) != 0 ||
            priv->current_index_root->current_dir_content_filtered ||
-           file_notifier_is_directory_modified (notifier, directory)) {
+           directory_modified) {
                /* The directory has updated its mtime, this means something
                 * was either added or removed in the mean time. Crawling
                 * will always find all newly added files. But still, we


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]