[tracker/tracker-0.10] libtracker-miner: Do not possibly leave stale resources



commit 5619c1200b66d5ea88cb9cd552c28122d95e75c5
Author: Carlos Garnacho <carlos lanedo com>
Date:   Mon Oct 31 17:30:24 2011 +0100

    libtracker-miner: Do not possibly leave stale resources
    
    Fixes NB#273694. If item_add_or_update_cb() was called on
    a just deleted file, it would actually trigger an sparql
    update where nie:url is deleted to never be replaced, thus
    leaving a stale resource with no nie:url.
    
    Instead, fallback to item_removed() if G_IO_ERROR_NOT_FOUND
    happens on a file known to the store, a second item_remove()
    call might happen anyway on monitor events, but it'd be just
    ignored.

 src/libtracker-miner/tracker-miner-fs.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 4eb1d63..974ba6d 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -377,6 +377,8 @@ static void           crawler_finished_cb                 (TrackerCrawler
                                                            gpointer              user_data);
 static void           crawl_directories_start             (TrackerMinerFS       *fs);
 static void           crawl_directories_stop              (TrackerMinerFS       *fs);
+static gboolean       item_remove                         (TrackerMinerFS       *fs,
+                                                           GFile                *file);
 static void           item_queue_handlers_set_up          (TrackerMinerFS       *fs);
 static void           item_update_children_uri            (TrackerMinerFS       *fs,
                                                            RecursiveMoveData    *data,
@@ -1922,6 +1924,20 @@ item_add_or_update_cb (TrackerMinerFS *fs,
 				tracker_task_unref (extraction_task);
 
 				item_queue_handlers_set_up (fs);
+				g_free (uri);
+				return;
+			} else if (error->code == G_IO_ERROR_NOT_FOUND) {
+				/* File was not found, remove it
+				 * if it was in the store
+				 */
+				if (ctxt->urn) {
+					item_remove (fs, task_file);
+				} else {
+					item_queue_handlers_set_up (fs);
+				}
+
+				tracker_task_unref (extraction_task);
+				g_free (uri);
 				return;
 			}
 		}



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