[tracker/sam/miner-fs-ignore-non-files: 2/2] miner-fs: Give clearer warning for missing nfo:fileLastModified
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/miner-fs-ignore-non-files: 2/2] miner-fs: Give clearer warning for missing nfo:fileLastModified
- Date: Tue, 30 Dec 2014 21:23:21 +0000 (UTC)
commit eb575df602797b1fa3df1bf4d4b64774d25af9a8
Author: Sam Thursfield <sam afuera me uk>
Date: Tue Dec 23 16:00:22 2014 +0000
miner-fs: Give clearer warning for missing nfo:fileLastModified
This error should be rare after the previous commit, but it's still
possible.
src/libtracker-miner/tracker-file-notifier.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index d0d418e..ef8ad54 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -505,11 +505,12 @@ sparql_files_query_populate (TrackerFileNotifier *notifier,
while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
GFile *file, *canonical, *root;
- const gchar *time_str, *iri;
+ const gchar *time_str, *uri, *iri;
GError *error = NULL;
guint64 _time;
- file = g_file_new_for_uri (tracker_sparql_cursor_get_string (cursor, 0, NULL));
+ uri = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+ file = g_file_new_for_uri (uri);
if (check_root) {
/* If it's a config root itself, other than the one
@@ -528,7 +529,19 @@ sparql_files_query_populate (TrackerFileNotifier *notifier,
iri = tracker_sparql_cursor_get_string (cursor, 1, NULL);
time_str = tracker_sparql_cursor_get_string (cursor, 2, NULL);
- _time = tracker_string_to_date (time_str, NULL, &error);
+
+ if (time_str == NULL) {
+ /* This can happen if someone inserted the file's metadata in the store using INSERT
+ * statements, rather than going through the FS miner. Or if for some reason they
+ * deleted the nfo:fileLastModified information. We report the store_mtime of the
+ * file as 0 so that it will get recrawled, if it is still present on disk, in
+ * file_notifier_traverse_tree_foreach().
+ */
+ g_warning ("File %s has no nfo:fileLastModified time set.", uri);
+ _time = 0;
+ } else {
+ _time = tracker_string_to_date (time_str, NULL, &error);
+ }
if (error) {
/* This should never happen. Assume that file was modified. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]