diff --git a/0001-augeas-trim-spaces-on-eol-around-value-separator.patch b/0001-augeas-trim-spaces-on-eol-around-value-separator.patch new file mode 100644 index 0000000..75e8a49 --- /dev/null +++ b/0001-augeas-trim-spaces-on-eol-around-value-separator.patch @@ -0,0 +1,100 @@ +From bc3149ba31c063d334dd95a21c4214cef11f46da Mon Sep 17 00:00:00 2001 +From: Julius Milan +Date: Wed, 22 Mar 2017 14:10:04 +0100 +Subject: [PATCH] augeas: trim spaces on eol, around value separator + +Resolves abrt/libreport#474 +Related to rhbz#1434414 +--- + augeas/libreport.aug | 19 ++++++++++++------- + augeas/test_libreport.aug | 20 ++++++++++++++++++++ + 2 files changed, 32 insertions(+), 7 deletions(-) + +diff --git a/augeas/libreport.aug b/augeas/libreport.aug +index 483eeaf..46ffb73 100644 +--- a/augeas/libreport.aug ++++ b/augeas/libreport.aug +@@ -2,19 +2,24 @@ module Libreport = + autoload xfm + + (* Define useful primitives *) +- let value_sep = del / ?= ?/ " = " +- let value_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n]?)/ +- let eol = del /\n/ "\n" +- let ident = /[a-zA-Z][a-zA-Z_]+/ ++ let val_sep = del /[ \t]*=[ \t]*/ " = " ++ let val = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ ++ let eol = del /\n/ "\n" ++ let whitespace_eol = del /[ \t]*\n/ "\n" ++ let ident = /[a-zA-Z][a-zA-Z_]+/ + + (* Define comment *) +- let comment = [ label "#comment" . del /#[ \t]*/ "# " . value_to_eol . eol ] ++ let commented_line = [ label "#comment" . del /#[ \t]*/ "# " . val . eol ] ++ let empty_comment = [ label "#comment" . value "" . del /#[ \t]*/ "# " . eol ] ++ let comment = commented_line | empty_comment + + (* Define empty *) +- let empty = [ del /[ \t]*\n/ "\n" ] ++ let empty = [ del /[ \t]*\n/ "\n" ] + + (* Define option *) +- let option = [ del /[ \t]*/ "" . key ident . value_sep . value_to_eol . eol ] ++ let option_val = [ del /[ \t]*/ "" . key ident . val_sep . val . whitespace_eol ] ++ let option_no_val = [ value "" . del /[ \t]*/ "" . key ident . val_sep . eol ] ++ let option = option_val | option_no_val + + (* Define lens *) + let lns = ( comment | empty | option )* +diff --git a/augeas/test_libreport.aug b/augeas/test_libreport.aug +index 116e97c..3dfbfa6 100644 +--- a/augeas/test_libreport.aug ++++ b/augeas/test_libreport.aug +@@ -16,6 +16,8 @@ Password = + # bugs in selinux-policy component. + # (If you need to add more, the syntax is: \"component[,component...]\") + # ++# ++# + DontMatchComponents = selinux-policy + + # for more info about these settings see: https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets +@@ -25,6 +27,14 @@ PrivateGroups=private + Whitespace_two=start + Whitespace_three =start + Whitespace_four= start ++ ++AssignmentWhitespace_a =what ++ AssignmentWhitespace_b = an ++AssignmentWhitespace_c= original ++ AssignmentWhitespace_d = idea ++ ++EOLWhitespace_a = nice ++EOLWhitespace_b = nice + " + + test Libreport.lns get conf = +@@ -44,6 +54,8 @@ PrivateGroups=private + { "#comment" = "bugs in selinux-policy component." } + { "#comment" = "(If you need to add more, the syntax is: \"component[,component...]\")" } + { "#comment" = "" } ++ { "#comment" = "" } ++ { "#comment" = "" } + { "DontMatchComponents" = "selinux-policy" } + {} + { "#comment" = "for more info about these settings see: https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets" } +@@ -53,3 +65,11 @@ PrivateGroups=private + { "Whitespace_two" = "start" } + { "Whitespace_three" = "start" } + { "Whitespace_four" = "start" } ++ {} ++ { "AssignmentWhitespace_a" = "what" } ++ { "AssignmentWhitespace_b" = "an" } ++ { "AssignmentWhitespace_c" = "original" } ++ { "AssignmentWhitespace_d" = "idea" } ++ {} ++ { "EOLWhitespace_a" = "nice" } ++ { "EOLWhitespace_b" = "nice" } +-- +2.9.3 + diff --git a/0002-reporter-s-journal-add-journal-default-entries.patch b/0002-reporter-s-journal-add-journal-default-entries.patch new file mode 100644 index 0000000..745ac09 --- /dev/null +++ b/0002-reporter-s-journal-add-journal-default-entries.patch @@ -0,0 +1,63 @@ +From f97b21d1e1d4bff4e667991997dd78fec3b95159 Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Tue, 14 Mar 2017 12:55:25 +0100 +Subject: [PATCH] reporter-s-journal: add journal default entries + +This commit adds 3 new fields into journal logs. All of them are in the +NONE dump. + +The new fields are: +PROBLEM_DIR - Represents absolute file system path of problem directory. + The full path is needed because that is the way with which are + problems identified in DBus Problems2API. +PROBLEM_UUID - Represents uuid +PROBLEM_DUPHASH - Represents duphash + +These new fields were needed for ABRT in Cockpit for connecting problems +with journal entries. All three are needed, because the problem directory +might be removed at the time of reading journal but a dupe can be +present there and the dupe can be identified based on DUPHASH or UUID. + +Signed-off-by: Matej Habrnal +--- + src/plugins/reporter-systemd-journal.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/plugins/reporter-systemd-journal.c b/src/plugins/reporter-systemd-journal.c +index 8df5ac7..957002b 100644 +--- a/src/plugins/reporter-systemd-journal.c ++++ b/src/plugins/reporter-systemd-journal.c +@@ -102,6 +102,7 @@ static void msg_content_free(msg_content_t *msg_c) + #define BINARY_NAME "binary" + #define SYSLOG_ID "SYSLOG_IDENTIFIER" + #define MESSAGE_ID "MESSAGE_ID" ++#define DUMPDIR_PATH "DIR" + + enum { + DUMP_NONE = 1 << 0, +@@ -122,6 +123,9 @@ static const char *const fields_default[] = { + FILENAME_EXCEPTION_TYPE , + FILENAME_REASON , + FILENAME_CRASH_FUNCTION , ++ DUMPDIR_PATH , ++ FILENAME_UUID , ++ FILENAME_DUPHASH , + NULL + }; + +@@ -302,6 +306,12 @@ int main(int argc, char **argv) + if (binary_name) + problem_data_add_text_noteditable(problem_data, BINARY_NAME, binary_name); + ++ /* add problem dir path into problem data */ ++ char *abspath = realpath(dump_dir_name, NULL); ++ if (abspath) ++ problem_data_add_text_noteditable(problem_data, DUMPDIR_PATH, abspath); ++ free(abspath); ++ + /* crash_function element is neeeded by systemd journal messages, save ??, if it doesn't exist */ + const char *crash_function = problem_data_get_content_or_NULL(problem_data, FILENAME_CRASH_FUNCTION); + if (!crash_function) +-- +2.9.3 + diff --git a/0003-reporter-s-journal-add-count-to-default-logs.patch b/0003-reporter-s-journal-add-count-to-default-logs.patch new file mode 100644 index 0000000..f969d50 --- /dev/null +++ b/0003-reporter-s-journal-add-count-to-default-logs.patch @@ -0,0 +1,37 @@ +From d2b5f09e2757f2585eb1003fdf6db43e58013c19 Mon Sep 17 00:00:00 2001 +From: Matej Marusak +Date: Tue, 21 Mar 2017 09:04:38 +0100 +Subject: [PATCH] reporter-s-journal: add count to default logs + +Field count is available only in FULL dump. There are however two good +reasons why to include this in NONE dump. + +1. It is quite useful to know if this problem occurred first time or is it +problem that happens a lot. + +2. We need it for cockpit integration. If the problem happened more times it +will have multiple logs. By comparing count in the log and real count, we can +know, if this is the last log of the problem. (timestamps do not work ideally +for this, since the time of problem does not equal to the time of the +log - there is some delay) + +Signed-off-by: Matej Marusak +--- + src/plugins/reporter-systemd-journal.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/plugins/reporter-systemd-journal.c b/src/plugins/reporter-systemd-journal.c +index 957002b..d12296e 100644 +--- a/src/plugins/reporter-systemd-journal.c ++++ b/src/plugins/reporter-systemd-journal.c +@@ -126,6 +126,7 @@ static const char *const fields_default[] = { + DUMPDIR_PATH , + FILENAME_UUID , + FILENAME_DUPHASH , ++ FILENAME_COUNT , + NULL + }; + +-- +2.9.3 + diff --git a/libreport.spec b/libreport.spec index 0fd468e..bced734 100644 --- a/libreport.spec +++ b/libreport.spec @@ -6,7 +6,7 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.9.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: https://abrt.readthedocs.org/ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz @@ -14,6 +14,9 @@ Source1: autogen.sh # git format-patch %%{Version} -N -M --topo-order # i=0; for p in `ls 0*.patch`; do printf "Patch%04d: %s\n" $i $p; ((i++)); done +Patch0000: 0001-augeas-trim-spaces-on-eol-around-value-separator.patch +Patch0001: 0002-reporter-s-journal-add-journal-default-entries.patch +Patch0002: 0003-reporter-s-journal-add-count-to-default-logs.patch # git is need for '%%autosetup -S git' which automatically applies all the # patches above. Please, be aware that the patches must be generated @@ -714,6 +717,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog +* Thu Apr 13 2017 Matej Habrnal 2.9.1-2 +- add journal default entries to reporter-systemd-journal +- augeas: trim spaces on eol, around value separator +- Resolves: #1434414 + * Wed Mar 15 2017 Matej Habrnal 2.9.1-1 - build: do not upload tarball to fedorahosted.org - spec: do not use fedorahosted.org as source