From 5510757064250bedc35fc7fb09aae0d0eba6b3e5 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 13 Jan 2015 16:10:38 +0100 Subject: [PATCH] Backport upstream patch to restrict the amount of data that is logged for errors (GNOME #735406) --- ...-Restrict-the-amount-of-data-that-is.patch | 59 +++++++++++++++++++ tracker.spec | 10 +++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 0001-libtracker-miner-Restrict-the-amount-of-data-that-is.patch diff --git a/0001-libtracker-miner-Restrict-the-amount-of-data-that-is.patch b/0001-libtracker-miner-Restrict-the-amount-of-data-that-is.patch new file mode 100644 index 0000000..3b7de55 --- /dev/null +++ b/0001-libtracker-miner-Restrict-the-amount-of-data-that-is.patch @@ -0,0 +1,59 @@ +From 59745984f91fa0c5e464c312c3a142fe3bd3b853 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Tue, 13 Jan 2015 14:51:50 +0100 +Subject: [PATCH] libtracker-miner: Restrict the amount of data that is logged + for errors + +SPARQL update strings can be very long if the entire text of a document +is being stored. Dumping these huge strings to the log eats up disk +space and makes them harder to follow. + +However, often, the occurence of such an error indicates a broken +extractor. In those cases, knowing part of the SPARQL can help in +identifying the file that triggered the error. + +Usually the "nie:plainTextContent" property is the last one in the +string, so we truncate the error messages at the first occurance of +this property to achieve the best of both worlds. + +https://bugzilla.gnome.org/show_bug.cgi?id=735406 +--- + src/libtracker-miner/tracker-decorator.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c +index b8978d8..781e4de 100644 +--- a/src/libtracker-miner/tracker-decorator.c ++++ b/src/libtracker-miner/tracker-decorator.c +@@ -19,6 +19,8 @@ + + #include "config.h" + ++#include ++ + #include "tracker-decorator.h" + #include "tracker-decorator-internal.h" + #include "tracker-priority-queue.h" +@@ -365,9 +367,17 @@ decorator_commit_cb (GObject *object, + child_error = g_ptr_array_index (errors, i); + + if (child_error) { ++ gchar *msg, *p; ++ ++ msg = g_strdup (g_ptr_array_index (sparql, i)); ++ p = strstr (msg, "nie:plainTextContent"); ++ if (p != NULL) ++ *p = '\0'; ++ + g_warning ("Task %d, error: %s", i, child_error->message); +- g_warning ("Sparql update was:\n%s\n", +- (gchar *) g_ptr_array_index (sparql, i)); ++ g_warning ("Sparql update was:\n%s\n", msg); ++ ++ g_free (msg); + } + } + +-- +2.1.0 + diff --git a/tracker.spec b/tracker.spec index cf9e7de..9d30afc 100644 --- a/tracker.spec +++ b/tracker.spec @@ -16,7 +16,7 @@ Name: tracker Version: 1.3.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Desktop-neutral search tool and indexer Group: Applications/System @@ -31,6 +31,9 @@ Patch0: 0001-Only-autostart-in-GNOME-771601.patch # https://bugzilla.gnome.org/show_bug.cgi?id=742391 Patch1: 0001-miners-Detect-locale-changes-only-when-the-miner-cou.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=735406 +Patch2: 0001-libtracker-miner-Restrict-the-amount-of-data-that-is.patch + BuildRequires: desktop-file-utils BuildRequires: firefox BuildRequires: giflib-devel @@ -176,6 +179,7 @@ This package contains the documentation for tracker %patch0 -p1 -b .autostart-gnome %patch1 -p1 -b .detect-locale-changes +%patch2 -p1 -b .restrict-logs ## nuke unwanted rpaths, see also ## https://fedoraproject.org/wiki/Packaging/Guidelines#Beware_of_Rpath @@ -322,6 +326,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog +* Tue Jan 13 2015 Debarshi Ray - 1.3.2-3 +- Backport upstream patch to restrict the amount of data that is logged for + errors (GNOME #735406) + * Tue Jan 06 2015 Debarshi Ray - 1.3.2-2 - Backport upstream patch to fix a crash (GNOME #742391)