diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2014-12-23 16:00:22 +0000 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2014-12-26 23:23:06 +0000 |
commit | eb575df602797b1fa3df1bf4d4b64774d25af9a8 (patch) | |
tree | a1724a94a78d88cbd2d3b98478f528c1aa53ce27 | |
parent | 6537c3c39091e047675bcb89ddfc87d02c378f38 (diff) | |
download | tracker-sam/miner-fs-ignore-non-files.tar.gz |
miner-fs: Give clearer warning for missing nfo:fileLastModifiedsam/miner-fs-ignore-non-files
This error should be rare after the previous commit, but it's still
possible.
-rw-r--r-- | 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 d0d418e1b..ef8ad54d1 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. */ |