[tracker-miners/sam/fix-domainontology-gtype-conflict] tracker-extract: Initialize logging before calling into Gio



commit 83ecaa21b9a0effe24c48593808cfb19e251cf42
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Jul 15 00:55:49 2019 +0100

    tracker-extract: Initialize logging before calling into Gio
    
    This prevents any risk of debug messages being written to stdout
    when they are not wanted, which is particularly important for
    tracker-extract because in `--file` mode we expect its output to be
    valid JSON.
    
    The unwanted message I was seeing was this:
    
        _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for ‘gio-vfs’

 src/tracker-extract/tracker-main.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index 58ef19005..6f49623e0 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -394,25 +394,6 @@ main (int argc, char *argv[])
 
        setlocale (LC_ALL, "");
 
-       tracker_sparql_connection_set_domain (domain_ontology_name);
-
-       tracker_load_domain_config (domain_ontology_name, &dbus_domain_name, &error);
-
-       if (error) {
-               g_critical ("Could not load domain ontology '%s': %s",
-                           domain_ontology_name, error->message);
-               g_error_free (error);
-               return EXIT_FAILURE;
-       }
-
-       connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &error);
-       if (error) {
-               g_critical ("Could not create DBus connection: %s\n",
-                           error->message);
-               g_error_free (error);
-               return EXIT_FAILURE;
-       }
-
        config = tracker_config_new ();
 
        /* Extractor command line arguments */
@@ -433,6 +414,25 @@ main (int argc, char *argv[])
                return run_standalone (config);
        }
 
+       tracker_sparql_connection_set_domain (domain_ontology_name);
+
+       tracker_load_domain_config (domain_ontology_name, &dbus_domain_name, &error);
+
+       if (error) {
+               g_critical ("Could not load domain ontology '%s': %s",
+                           domain_ontology_name, error->message);
+               g_error_free (error);
+               return EXIT_FAILURE;
+       }
+
+       connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &error);
+       if (error) {
+               g_critical ("Could not create DBus connection: %s\n",
+                           error->message);
+               g_error_free (error);
+               return EXIT_FAILURE;
+       }
+
        /* Initialize subsystems */
        initialize_directories ();
 


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