[tracker/follow-symlinks: 1/5] libtracker-miner: Add TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/follow-symlinks: 1/5] libtracker-miner: Add TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS
- Date: Fri, 5 Sep 2014 15:24:26 +0000 (UTC)
commit 6e492734f4dfac2c68c828cb63cb9e59b57e8b23
Author: Martyn Russell <martyn lanedo com>
Date: Fri Sep 5 16:22:46 2014 +0100
libtracker-miner: Add TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS
src/libtracker-miner/tracker-crawler.c | 6 +++++-
src/libtracker-miner/tracker-file-data-provider.c | 6 +++++-
src/libtracker-miner/tracker-indexing-tree.c | 6 +++++-
src/libtracker-miner/tracker-miner-enums.h | 8 +++++++-
4 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index aaeab7f..5e99550 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -493,7 +493,11 @@ directory_root_info_new (GFile *file,
GFileInfo *file_info;
GFileQueryInfoFlags file_flags;
- file_flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
+ file_flags = G_FILE_QUERY_INFO_NONE;
+
+ if ((info->flags & TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS) == 0) {
+ file_flags |= G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
+ }
file_info = g_file_query_info (file,
file_attributes,
diff --git a/src/libtracker-miner/tracker-file-data-provider.c
b/src/libtracker-miner/tracker-file-data-provider.c
index 2b2e125..7a29cbd 100644
--- a/src/libtracker-miner/tracker-file-data-provider.c
+++ b/src/libtracker-miner/tracker-file-data-provider.c
@@ -118,6 +118,8 @@ file_data_provider_begin (TrackerDataProvider *data_provider,
return NULL;
}
+ file_flags = G_FILE_QUERY_INFO_NONE;
+
/* We ignore the TRACKER_DIRECTORY_FLAG_NO_STAT here, it makes
* no sense to be at this point with that flag. So we warn
* about it...
@@ -128,7 +130,9 @@ file_data_provider_begin (TrackerDataProvider *data_provider,
__FUNCTION__);
}
- file_flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
+ if ((flags & TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS) == 0) {
+ file_flags |= G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
+ }
fe = g_file_enumerate_children (url,
attributes,
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index c303e6b..2e02f48 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -709,7 +709,11 @@ tracker_indexing_tree_file_is_indexable (TrackerIndexingTree *tree,
(config_flags & TRACKER_DIRECTORY_FLAG_NO_STAT) != 0) {
GFileQueryInfoFlags file_flags;
- file_flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
+ file_flags = G_FILE_QUERY_INFO_NONE;
+
+ if ((config_flags & TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS) == 0) {
+ file_flags |= G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
+ }
file_type = g_file_query_file_type (file, file_flags, NULL);
diff --git a/src/libtracker-miner/tracker-miner-enums.h b/src/libtracker-miner/tracker-miner-enums.h
index 932fa77..267135b 100644
--- a/src/libtracker-miner/tracker-miner-enums.h
+++ b/src/libtracker-miner/tracker-miner-enums.h
@@ -53,6 +53,11 @@ G_BEGIN_DECLS
* server somewhere), use the #TRACKER_DIRECTORY_FLAG_NO_STAT flag.
* The default is to use stat() and assume we're mining a local or
* mounted file system.
+ * @TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS: The #TrackerEnumerator
+ * should follow symlinks. This is disabled by default because it is
+ * easy for Tracker to get into recursive loop situations with
+ * symlinks. For those using interesting scenarios like git-annex or
+ * software heavily using symlinks (and properly) this is for you.
*
* Flags used when adding a new directory to be indexed in the
* #TrackerIndexingTree, #TrackerDataProvider and #TrackerEnumerator.
@@ -65,7 +70,8 @@ typedef enum {
TRACKER_DIRECTORY_FLAG_IGNORE = 1 << 4,
TRACKER_DIRECTORY_FLAG_PRESERVE = 1 << 5,
TRACKER_DIRECTORY_FLAG_PRIORITY = 1 << 6,
- TRACKER_DIRECTORY_FLAG_NO_STAT = 1 << 7
+ TRACKER_DIRECTORY_FLAG_NO_STAT = 1 << 7,
+ TRACKER_DIRECTORY_FLAG_FOLLOW_SYMLINKS = 1 << 8,
} TrackerDirectoryFlags;
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]