Blame SOURCES/0001-nie-url-UNIQUE-constraint-fixes.patch

af89cd
From df26e2e0c3e36ed02f87e249bee788d54886e9dd Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Mon, 26 Dec 2016 21:49:44 +0100
af89cd
Subject: [PATCH 1/8] libtracker-miner: Fully stop TrackerFileNotifier
af89cd
 operations on errors
af89cd
af89cd
It oddly tried to just keep going, which may result in spurious deletes
af89cd
or partial inserts. Sounds better to just drop the ball on the directory
af89cd
at hand, it should be correctly indexed eventually.
af89cd
---
af89cd
 src/libtracker-miner/tracker-file-notifier.c | 22 +++++++++++++---------
af89cd
 1 file changed, 13 insertions(+), 9 deletions(-)
af89cd
af89cd
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
af89cd
index 4d3ec2467..5b1abe095 100644
af89cd
--- a/src/libtracker-miner/tracker-file-notifier.c
af89cd
+++ b/src/libtracker-miner/tracker-file-notifier.c
af89cd
@@ -779,9 +779,11 @@ sparql_contents_query_cb (GObject      *object,
af89cd
 	cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
af89cd
 	                                                 result, &error);
af89cd
 	if (error) {
af89cd
-		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
af89cd
-			goto out;
af89cd
-		g_warning ("Could not query directory contents: %s\n", error->message);
af89cd
+		if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
af89cd
+			g_warning ("Could not query directory contents: %s\n", error->message);
af89cd
+			finish_current_directory (notifier, TRUE);
af89cd
+		}
af89cd
+		goto out;
af89cd
 	}
af89cd
 
af89cd
 	notifier = user_data;
af89cd
@@ -865,17 +867,19 @@ sparql_files_query_cb (GObject      *object,
af89cd
 	GFile *directory;
af89cd
 	guint flags;
af89cd
 
af89cd
+	notifier = data->notifier;
af89cd
+	priv = notifier->priv;
af89cd
+
af89cd
 	cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
af89cd
 	                                                 result, &error);
af89cd
 	if (error) {
af89cd
-		if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
af89cd
-			goto out;
af89cd
-		g_warning ("Could not query indexed files: %s\n", error->message);
af89cd
+		if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
af89cd
+			g_warning ("Could not query indexed files: %s\n", error->message);
af89cd
+			finish_current_directory (notifier, TRUE);
af89cd
+		}
af89cd
+		goto out;
af89cd
 	}
af89cd
 
af89cd
-	notifier = data->notifier;
af89cd
-	priv = notifier->priv;
af89cd
-
af89cd
 	if (cursor) {
af89cd
 		sparql_files_query_populate (notifier, cursor, TRUE);
af89cd
 		g_object_unref (cursor);
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From 1f5ac7a8c3db62d23c0148429905eeaf5c45b36d Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Sun, 16 Apr 2017 11:58:00 -0300
af89cd
Subject: [PATCH 2/8] libtracker-miner: Shuffle refcount handling when queueing
af89cd
 back a file
af89cd
af89cd
The file might or might not be inserted to the queue, which meant that
af89cd
the extra ref created outside the call might never dropped if the file
af89cd
didn't end up inserted again. Fix this by doing the refcount increase
af89cd
when actually inserting the file back in the queue.
af89cd
af89cd
Reported by Jose M. Arroyo <jose.m.arroyo.se@gmail.com>.
af89cd
---
af89cd
 src/libtracker-miner/tracker-miner-fs.c | 24 +++++++-----------------
af89cd
 1 file changed, 7 insertions(+), 17 deletions(-)
af89cd
af89cd
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
af89cd
index 02b4a4755..15ac82f4d 100644
af89cd
--- a/src/libtracker-miner/tracker-miner-fs.c
af89cd
+++ b/src/libtracker-miner/tracker-miner-fs.c
af89cd
@@ -2109,11 +2109,10 @@ should_wait (TrackerMinerFS *fs,
af89cd
 }
af89cd
 
af89cd
 static gboolean
af89cd
-item_reenqueue_full (TrackerMinerFS       *fs,
af89cd
-                     TrackerPriorityQueue *item_queue,
af89cd
-                     GFile                *queue_file,
af89cd
-                     gpointer              queue_data,
af89cd
-                     gint                  priority)
af89cd
+item_enqueue_again (TrackerMinerFS       *fs,
af89cd
+                    TrackerPriorityQueue *item_queue,
af89cd
+                    GFile                *queue_file,
af89cd
+                    gint                  priority)
af89cd
 {
af89cd
 	gint reentry_counter;
af89cd
 	gchar *uri;
af89cd
@@ -2126,7 +2125,7 @@ item_reenqueue_full (TrackerMinerFS       *fs,
af89cd
 		g_object_set_qdata (G_OBJECT (queue_file),
af89cd
 		                    fs->priv->quark_reentry_counter,
af89cd
 		                    GINT_TO_POINTER (reentry_counter + 1));
af89cd
-		tracker_priority_queue_add (item_queue, queue_data, priority);
af89cd
+		tracker_priority_queue_add (item_queue, g_object_ref (queue_file), priority);
af89cd
 
af89cd
 		should_wait = TRUE;
af89cd
 	} else {
af89cd
@@ -2147,15 +2146,6 @@ item_reenqueue_full (TrackerMinerFS       *fs,
af89cd
 	return should_wait;
af89cd
 }
af89cd
 
af89cd
-static gboolean
af89cd
-item_reenqueue (TrackerMinerFS       *fs,
af89cd
-                TrackerPriorityQueue *item_queue,
af89cd
-                GFile                *queue_file,
af89cd
-                gint                  priority)
af89cd
-{
af89cd
-	return item_reenqueue_full (fs, item_queue, queue_file, queue_file, priority);
af89cd
-}
af89cd
-
af89cd
 static QueueState
af89cd
 item_queue_get_next_file (TrackerMinerFS  *fs,
af89cd
                           GFile          **file,
af89cd
@@ -2601,8 +2591,8 @@ item_queue_handlers_cb (gpointer user_data)
af89cd
 			 * ensured, tasks are inserted at a higher priority so they
af89cd
 			 * are processed promptly anyway.
af89cd
 			 */
af89cd
-			item_reenqueue (fs, item_queue, g_object_ref (parent), priority - 1);
af89cd
-			item_reenqueue (fs, item_queue, g_object_ref (file), priority);
af89cd
+			item_enqueue_again (fs, item_queue, parent, priority - 1);
af89cd
+			item_enqueue_again (fs, item_queue, file, priority);
af89cd
 
af89cd
 			keep_processing = TRUE;
af89cd
 		}
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From cc917a0c029ebc46a1fbca5d73a9bd67b27e2e57 Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Thu, 6 Jul 2017 11:19:17 +0200
af89cd
Subject: [PATCH 3/8] libtracker-miner: Fix warnings if move ops happened
af89cd
 during initial crawling
af89cd
af89cd
The checks to notify about indexing having finished on TrackerIndexingTree
af89cd
roots were mistaking ItemMovedData* with GFile*, which lead to warnings.
af89cd
This should be harmless, the signal might be possibly emitted before the
af89cd
move op is dispatched, that's all.
af89cd
---
af89cd
 src/libtracker-miner/tracker-miner-fs.c | 11 ++++++++++-
af89cd
 1 file changed, 10 insertions(+), 1 deletion(-)
af89cd
af89cd
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
af89cd
index 15ac82f4d..baa2c9a7a 100644
af89cd
--- a/src/libtracker-miner/tracker-miner-fs.c
af89cd
+++ b/src/libtracker-miner/tracker-miner-fs.c
af89cd
@@ -1110,6 +1110,15 @@ miner_resumed (TrackerMiner *miner)
af89cd
 	}
af89cd
 }
af89cd
 
af89cd
+static gboolean
af89cd
+item_moved_data_has_prefix (gpointer data,
af89cd
+			    gpointer user_data)
af89cd
+{
af89cd
+	ItemMovedData *moved_item = data;
af89cd
+	GFile *prefix = user_data;
af89cd
+
af89cd
+	return g_file_has_prefix (moved_item->file, prefix);
af89cd
+}
af89cd
 
af89cd
 static void
af89cd
 miner_ignore_next_update (TrackerMiner *miner, const GStrv urls)
af89cd
@@ -1165,7 +1174,7 @@ notify_roots_finished (TrackerMinerFS *fs,
af89cd
 		    (tracker_priority_queue_find (fs->priv->items_created, NULL, (GEqualFunc) g_file_has_prefix, root) ||
af89cd
 		     tracker_priority_queue_find (fs->priv->items_updated, NULL, (GEqualFunc) g_file_has_prefix, root) ||
af89cd
 		     tracker_priority_queue_find (fs->priv->items_deleted, NULL, (GEqualFunc) g_file_has_prefix, root) ||
af89cd
-		     tracker_priority_queue_find (fs->priv->items_moved, NULL, (GEqualFunc) g_file_has_prefix, root) ||
af89cd
+		     tracker_priority_queue_find (fs->priv->items_moved, NULL, (GEqualFunc) item_moved_data_has_prefix, root) ||
af89cd
 		     tracker_priority_queue_find (fs->priv->items_writeback, NULL, (GEqualFunc) g_file_has_prefix, root))) {
af89cd
 			continue;
af89cd
 		}
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From 74ad92e34d8f58e9c8f015bf9f3173e3f738a23c Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Sun, 9 Jul 2017 19:08:54 +0200
af89cd
Subject: [PATCH 4/8] libtracker-miner: Ensure sparql buffer keeps flushing
af89cd
af89cd
The sparql buffer might get full again with new tasks before the
af89cd
update_array operation for the current batch returned. In this case
af89cd
nothing will kick the TrackerMinerFS again, nor the SPARQL buffer
af89cd
from flushing again. Fix this by just flushing again, the miner
af89cd
will follow as soon as the SPARQL buffer is below limits.
af89cd
---
af89cd
 src/libtracker-miner/tracker-sparql-buffer.c | 8 +++++++-
af89cd
 1 file changed, 7 insertions(+), 1 deletion(-)
af89cd
af89cd
diff --git a/src/libtracker-miner/tracker-sparql-buffer.c b/src/libtracker-miner/tracker-sparql-buffer.c
af89cd
index 5d0be93a4..95f9c8ede 100644
af89cd
--- a/src/libtracker-miner/tracker-sparql-buffer.c
af89cd
+++ b/src/libtracker-miner/tracker-sparql-buffer.c
af89cd
@@ -246,6 +246,7 @@ tracker_sparql_buffer_update_array_cb (GObject      *object,
af89cd
                                        gpointer      user_data)
af89cd
 {
af89cd
 	TrackerSparqlBufferPrivate *priv;
af89cd
+	TrackerSparqlBuffer *buffer;
af89cd
 	GError *global_error = NULL;
af89cd
 	GPtrArray *sparql_array_errors;
af89cd
 	UpdateArrayData *update_data;
af89cd
@@ -253,7 +254,8 @@ tracker_sparql_buffer_update_array_cb (GObject      *object,
af89cd
 
af89cd
 	/* Get arrays of errors and queries */
af89cd
 	update_data = user_data;
af89cd
-	priv = TRACKER_SPARQL_BUFFER (update_data->buffer)->priv;
af89cd
+	buffer = TRACKER_SPARQL_BUFFER (update_data->buffer);
af89cd
+	priv = buffer->priv;
af89cd
 	priv->n_updates--;
af89cd
 
af89cd
 	g_debug ("(Sparql buffer) Finished array-update with %u tasks",
af89cd
@@ -338,6 +340,10 @@ tracker_sparql_buffer_update_array_cb (GObject      *object,
af89cd
 	if (global_error) {
af89cd
 		g_error_free (global_error);
af89cd
 	}
af89cd
+
af89cd
+	if (tracker_task_pool_limit_reached (TRACKER_TASK_POOL (buffer))) {
af89cd
+		tracker_sparql_buffer_flush (buffer, "SPARQL buffer limit reached (after flush)");
af89cd
+	}
af89cd
 }
af89cd
 
af89cd
 static gchar *
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From 534a1839a0f6e5bb71af7bc51b79f9d9e215266b Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Mon, 25 Sep 2017 12:26:33 +0200
af89cd
Subject: [PATCH 5/8] libtracker-miner: Check directory updates before dropping
af89cd
 mtime info
af89cd
af89cd
file_notifier_traverse_tree() has the side effect of deleting mtime data,
af89cd
as it's presumably not needed anymore, except here. Check whether the
af89cd
directory was updated before notifying of the files inside, so we can
af89cd
thoroughly check for deleted content.
af89cd
af89cd
https://bugzilla.gnome.org/show_bug.cgi?id=786132
af89cd
---
af89cd
 src/libtracker-miner/tracker-file-notifier.c | 7 +++++--
af89cd
 1 file changed, 5 insertions(+), 2 deletions(-)
af89cd
af89cd
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
af89cd
index 5b1abe095..433f79524 100644
af89cd
--- a/src/libtracker-miner/tracker-file-notifier.c
af89cd
+++ b/src/libtracker-miner/tracker-file-notifier.c
af89cd
@@ -863,6 +863,7 @@ sparql_files_query_cb (GObject      *object,
af89cd
 	TrackerFileNotifierPrivate *priv;
af89cd
 	TrackerFileNotifier *notifier;
af89cd
 	TrackerSparqlCursor *cursor;
af89cd
+	gboolean directory_modified;
af89cd
 	GError *error = NULL;
af89cd
 	GFile *directory;
af89cd
 	guint flags;
af89cd
@@ -885,13 +886,15 @@ sparql_files_query_cb (GObject      *object,
af89cd
 		g_object_unref (cursor);
af89cd
 	}
af89cd
 
af89cd
-	file_notifier_traverse_tree (notifier, data->max_depth);
af89cd
 	directory = priv->current_index_root->current_dir;
af89cd
 	flags = priv->current_index_root->flags;
af89cd
+	directory_modified = file_notifier_is_directory_modified (notifier, directory);
af89cd
+
af89cd
+	file_notifier_traverse_tree (notifier, data->max_depth);
af89cd
 
af89cd
 	if ((flags & TRACKER_DIRECTORY_FLAG_CHECK_DELETED) != 0 ||
af89cd
 	    priv->current_index_root->current_dir_content_filtered ||
af89cd
-	    file_notifier_is_directory_modified (notifier, directory)) {
af89cd
+	    directory_modified) {
af89cd
 		/* The directory has updated its mtime, this means something
af89cd
 		 * was either added or removed in the mean time. Crawling
af89cd
 		 * will always find all newly added files. But still, we
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From c48c677e3a5ba0045868049e28a52c5e5e49b980 Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Mon, 25 Sep 2017 12:12:47 +0200
af89cd
Subject: [PATCH 6/8] libtracker-miner: Always fallback to URN query when
af89cd
 queueing file
af89cd
af89cd
Tracker may end up with nfo:FileDataObject prior to handling monitor
af89cd
events. Be it leftover data from previous bugs, explicit "tracker index"
af89cd
calls, or data from some other application.
af89cd
af89cd
As we can't be really sure of the data consistence, always fallback to
af89cd
a URN query so we don't break nie:url UNIQUE constraint (inverse functional
af89cd
property in SPARQL parlance).
af89cd
af89cd
https://bugzilla.gnome.org/show_bug.cgi?id=786132
af89cd
---
af89cd
 src/libtracker-miner/tracker-miner-fs.c | 17 ++++++++---------
af89cd
 1 file changed, 8 insertions(+), 9 deletions(-)
af89cd
af89cd
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
af89cd
index baa2c9a7a..1a4af1c12 100644
af89cd
--- a/src/libtracker-miner/tracker-miner-fs.c
af89cd
+++ b/src/libtracker-miner/tracker-miner-fs.c
af89cd
@@ -2821,12 +2821,11 @@ miner_fs_cache_file_urn (TrackerMinerFS *fs,
af89cd
 static void
af89cd
 miner_fs_queue_file (TrackerMinerFS       *fs,
af89cd
                      TrackerPriorityQueue *item_queue,
af89cd
-                     GFile                *file,
af89cd
-                     gboolean              query_urn)
af89cd
+                     GFile                *file)
af89cd
 {
af89cd
 	gint priority;
af89cd
 
af89cd
-	miner_fs_cache_file_urn (fs, file, query_urn);
af89cd
+	miner_fs_cache_file_urn (fs, file, TRUE);
af89cd
 	priority = miner_fs_get_queue_priority (fs, file);
af89cd
 	tracker_priority_queue_add (item_queue, g_object_ref (file), priority);
af89cd
 }
af89cd
@@ -2981,7 +2980,7 @@ check_item_queues (TrackerMinerFS *fs,
af89cd
 			 */
af89cd
 			g_debug ("  Found matching unhandled CREATED event "
af89cd
 			         "for source file, merging both events together");
af89cd
-			miner_fs_queue_file (fs, fs->priv->items_created, other_file, FALSE);
af89cd
+			miner_fs_queue_file (fs, fs->priv->items_created, other_file);
af89cd
 
af89cd
 			return FALSE;
af89cd
 		}
af89cd
@@ -3016,7 +3015,7 @@ file_notifier_file_created (TrackerFileNotifier  *notifier,
af89cd
 	TrackerMinerFS *fs = user_data;
af89cd
 
af89cd
 	if (check_item_queues (fs, QUEUE_CREATED, file, NULL)) {
af89cd
-		miner_fs_queue_file (fs, fs->priv->items_created, file, FALSE);
af89cd
+		miner_fs_queue_file (fs, fs->priv->items_created, file);
af89cd
 		item_queue_handlers_set_up (fs);
af89cd
 	}
af89cd
 }
af89cd
@@ -3039,7 +3038,7 @@ file_notifier_file_deleted (TrackerFileNotifier  *notifier,
af89cd
 	}
af89cd
 
af89cd
 	if (check_item_queues (fs, QUEUE_DELETED, file, NULL)) {
af89cd
-		miner_fs_queue_file (fs, fs->priv->items_deleted, file, FALSE);
af89cd
+		miner_fs_queue_file (fs, fs->priv->items_deleted, file);
af89cd
 		item_queue_handlers_set_up (fs);
af89cd
 	}
af89cd
 }
af89cd
@@ -3070,7 +3069,7 @@ file_notifier_file_updated (TrackerFileNotifier  *notifier,
af89cd
 			                    GINT_TO_POINTER (TRUE));
af89cd
 		}
af89cd
 
af89cd
-		miner_fs_queue_file (fs, fs->priv->items_updated, file, TRUE);
af89cd
+		miner_fs_queue_file (fs, fs->priv->items_updated, file);
af89cd
 		item_queue_handlers_set_up (fs);
af89cd
 	}
af89cd
 }
af89cd
@@ -3416,7 +3415,7 @@ tracker_miner_fs_directory_remove_full (TrackerMinerFS *fs,
af89cd
 			 * to preserve remove_full() semantics.
af89cd
 			 */
af89cd
 			trace_eq_push_tail ("DELETED", file, "on remove full");
af89cd
-			miner_fs_queue_file (fs, fs->priv->items_deleted, file, FALSE);
af89cd
+			miner_fs_queue_file (fs, fs->priv->items_deleted, file);
af89cd
 			item_queue_handlers_set_up (fs);
af89cd
 		}
af89cd
 
af89cd
@@ -3460,7 +3459,7 @@ check_file_parents (TrackerMinerFS *fs,
af89cd
 
af89cd
 	for (p = parents; p; p = p->next) {
af89cd
 		trace_eq_push_tail ("UPDATED", p->data, "checking file parents");
af89cd
-		miner_fs_queue_file (fs, fs->priv->items_updated, p->data, TRUE);
af89cd
+		miner_fs_queue_file (fs, fs->priv->items_updated, p->data);
af89cd
 		g_object_unref (p->data);
af89cd
 	}
af89cd
 
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From 9df5d3cae1c79bdb3c5f930bf665fe5d1f442547 Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Sun, 24 Sep 2017 12:04:22 +0200
af89cd
Subject: [PATCH 7/8] tracker-miner-fs: Explicitly ignore non-native mounts
af89cd
af89cd
tracker-miner-fs does rely in a few places to index local content
af89cd
exclusively. Make it explicitly ignore non-native mounts, they won't
af89cd
be indexed anyway, but we can spare trying to create the tracker:Volume
af89cd
and mount root's nfo:FileDataObject for these.
af89cd
af89cd
Fixes nie:url constraint errors and other warnings when trying to deal
af89cd
with those.
af89cd
af89cd
https://bugzilla.gnome.org/show_bug.cgi?id=786132
af89cd
---
af89cd
 src/miners/fs/tracker-storage.c | 10 +++++++++-
af89cd
 1 file changed, 9 insertions(+), 1 deletion(-)
af89cd
af89cd
diff --git a/src/miners/fs/tracker-storage.c b/src/miners/fs/tracker-storage.c
af89cd
index 9ec59dbfd..6114a6fd6 100644
af89cd
--- a/src/miners/fs/tracker-storage.c
af89cd
+++ b/src/miners/fs/tracker-storage.c
af89cd
@@ -550,8 +550,16 @@ mount_add (TrackerStorage *storage,
af89cd
 
af89cd
 	/* Get root path of the mount */
af89cd
 	root = g_mount_get_root (mount);
af89cd
-	mount_path = g_file_get_path (root);
af89cd
+	if (!g_file_is_native (root)) {
af89cd
+		gchar *uri = g_file_get_uri (root);
af89cd
 
af89cd
+		g_debug ("Ignoring mount '%s', URI '%s' is not native",
af89cd
+		         mount_name, uri);
af89cd
+		g_free (uri);
af89cd
+		return;
af89cd
+	}
af89cd
+
af89cd
+	mount_path = g_file_get_path (root);
af89cd
 	g_debug ("Found '%s' mounted on path '%s'",
af89cd
 	         mount_name,
af89cd
 	         mount_path);
af89cd
-- 
af89cd
2.14.2
af89cd
af89cd
af89cd
From 907a867cd72827d5b24d6d8474d9e76d6ff095aa Mon Sep 17 00:00:00 2001
af89cd
From: Carlos Garnacho <carlosg@gnome.org>
af89cd
Date: Sun, 10 Sep 2017 17:01:26 +0200
af89cd
Subject: [PATCH 8/8] applications: Ignore broken symlinks
af89cd
af89cd
We still do need to query mtime from the symlink itself in order to keep
af89cd
filesystem accounting happy, so wait for ENOENT while doing
af89cd
g_key_file_load_from_file() in order to figure out we are dealing with
af89cd
a broken link (or a no longer existing file, which is also possible). This
af89cd
avoids spewing any warnings with those.
af89cd
af89cd
https://bugzilla.gnome.org/show_bug.cgi?id=786132
af89cd
---
af89cd
 src/miners/apps/tracker-miner-applications.c | 34 ++++++++++++++++------------
af89cd
 1 file changed, 20 insertions(+), 14 deletions(-)
af89cd
af89cd
diff --git a/src/miners/apps/tracker-miner-applications.c b/src/miners/apps/tracker-miner-applications.c
af89cd
index 749d3e4d2..a2d1f78d8 100644
af89cd
--- a/src/miners/apps/tracker-miner-applications.c
af89cd
+++ b/src/miners/apps/tracker-miner-applications.c
af89cd
@@ -430,8 +430,7 @@ get_desktop_key_file (GFile   *file,
af89cd
 	key_file = g_key_file_new ();
af89cd
 	*type = NULL;
af89cd
 
af89cd
-	if (!g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, NULL)) {
af89cd
-		g_set_error (error, miner_applications_error_quark, 0, "Couldn't load desktop file:'%s'", path);
af89cd
+	if (!g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, error)) {
af89cd
 		g_key_file_free (key_file);
af89cd
 		g_free (path);
af89cd
 		return NULL;
af89cd
@@ -943,6 +942,7 @@ process_file_cb (GObject      *object,
af89cd
 	ProcessApplicationData *data;
af89cd
 	GFileInfo *file_info;
af89cd
 	GError *error = NULL;
af89cd
+	GFileType file_type;
af89cd
 	GFile *file;
af89cd
 
af89cd
 	data = user_data;
af89cd
@@ -956,21 +956,27 @@ process_file_cb (GObject      *object,
af89cd
 		return;
af89cd
 	}
af89cd
 
af89cd
-	if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY) {
af89cd
+	file_type = g_file_info_get_file_type (file_info);
af89cd
+
af89cd
+	if (file_type == G_FILE_TYPE_DIRECTORY) {
af89cd
 		process_directory (data, file_info, &error);
af89cd
-	} else {
af89cd
+	} else if (file_type == G_FILE_TYPE_REGULAR ||
af89cd
+	           file_type == G_FILE_TYPE_SYMBOLIC_LINK) {
af89cd
 		data->key_file = get_desktop_key_file (file, &data->type, &error);
af89cd
 		if (!data->key_file) {
af89cd
-			gchar *uri;
af89cd
-
af89cd
-			uri = g_file_get_uri (file);
af89cd
-			g_warning ("Couldn't properly parse desktop file '%s': '%s'",
af89cd
-			           uri,
af89cd
-			           error ? error->message : "unknown error");
af89cd
-			g_free (uri);
af89cd
-			g_clear_error (&error);
af89cd
-
af89cd
-			error = g_error_new_literal (miner_applications_error_quark, 0, "File is not a key file");
af89cd
+			/* Ignore broken symlinks */
af89cd
+			if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
af89cd
+				gchar *uri;
af89cd
+
af89cd
+				uri = g_file_get_uri (file);
af89cd
+				g_warning ("Couldn't properly parse desktop file '%s': '%s'",
af89cd
+				           uri,
af89cd
+				           error ? error->message : "unknown error");
af89cd
+				g_free (uri);
af89cd
+				g_clear_error (&error);
af89cd
+
af89cd
+				error = g_error_new_literal (miner_applications_error_quark, 0, "File is not a key file");
af89cd
+			}
af89cd
 		} else if (g_key_file_get_boolean (data->key_file, GROUP_DESKTOP_ENTRY, "Hidden", NULL)) {
af89cd
 			error = g_error_new_literal (miner_applications_error_quark, 0, "Desktop file is 'hidden', not gathering metadata for it");
af89cd
 		} else {
af89cd
-- 
af89cd
2.14.2
af89cd