[tracker-miners/wip/carlosg/stable-urn-cache-init] tracker-extract: Initialize cache for stable content URNs at startup
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/stable-urn-cache-init] tracker-extract: Initialize cache for stable content URNs at startup
- Date: Wed, 16 Mar 2022 13:25:09 +0000 (UTC)
commit 4cda983b02e49f6bd28b94a6b96c9fe7026887ef
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Mar 16 13:47:50 2022 +0100
tracker-extract: Initialize cache for stable content URNs at startup
This cache initialization may incur in unexpected ioctls to probe
floppy/cdrom devices, and is nowadays left up to the first extractor
thread that queries a content identifier. This may result in seccomp
issues.
Perform this initialization on the main thread early during initialization
so the extractor threads find a populated cache when querying content
identifiers.
Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/355
src/libtracker-miners-common/tracker-file-utils.c | 9 +++++++++
src/libtracker-miners-common/tracker-file-utils.h | 2 ++
src/tracker-extract/tracker-main.c | 2 ++
3 files changed, 13 insertions(+)
---
diff --git a/src/libtracker-miners-common/tracker-file-utils.c
b/src/libtracker-miners-common/tracker-file-utils.c
index 8faa80713..ddc0e4c57 100644
--- a/src/libtracker-miners-common/tracker-file-utils.c
+++ b/src/libtracker-miners-common/tracker-file-utils.c
@@ -852,6 +852,15 @@ tracker_unix_mount_cache_lookup_filesystem_id (GFile *file)
return id;
}
+void
+tracker_content_identifier_cache_init (void)
+{
+ TrackerUnixMountCache *cache;
+
+ cache = tracker_unix_mount_cache_get ();
+ g_assert (cache != NULL);
+}
+
gchar *
tracker_file_get_content_identifier (GFile *file,
GFileInfo *info,
diff --git a/src/libtracker-miners-common/tracker-file-utils.h
b/src/libtracker-miners-common/tracker-file-utils.h
index f05535a41..6a0b1495d 100644
--- a/src/libtracker-miners-common/tracker-file-utils.h
+++ b/src/libtracker-miners-common/tracker-file-utils.h
@@ -44,6 +44,8 @@ gboolean tracker_file_is_locked (GFile *file);
gboolean tracker_file_is_hidden (GFile *file);
gint tracker_file_cmp (GFile *file_a,
GFile *file_b);
+
+void tracker_content_identifier_cache_init (void);
gchar * tracker_file_get_content_identifier (GFile *file,
GFileInfo *info,
const gchar *suffix);
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index c1a09685c..9aae5f6fd 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -368,6 +368,8 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
+ tracker_content_identifier_cache_init ();
+
cache_dir = get_cache_dir (domain_ontology);
tracker_error_report_init (cache_dir);
g_object_unref (cache_dir);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]