diff --git a/0002-Provide-SYSLOG_FACILITY-when-logging-through-journal.patch b/0002-Provide-SYSLOG_FACILITY-when-logging-through-journal.patch new file mode 100644 index 0000000..72bdd2f --- /dev/null +++ b/0002-Provide-SYSLOG_FACILITY-when-logging-through-journal.patch @@ -0,0 +1,30 @@ +From e9cf30794feeb17bfc13fe935d12db2e17696736 Mon Sep 17 00:00:00 2001 +From: Richard Marko +Date: Mon, 3 Feb 2014 14:47:21 +0100 +Subject: [LIBREPORT PATCH 2/6] Provide SYSLOG_FACILITY when logging through + journal + +Use SYSLOG_FACILITY=1 (user.notice) as a workaround +for rhbz#1026804. This ensures forwarding to rsyslog +works correctly. + +Signed-off-by: Richard Marko +--- + src/lib/logging.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/lib/logging.c b/src/lib/logging.c +index afa480b..259a634 100644 +--- a/src/lib/logging.c ++++ b/src/lib/logging.c +@@ -143,6 +143,7 @@ static void log_handler(int level, + "CODE_FILE=%s", file, + "CODE_LINE=%d", line, + "CODE_FUNC=%s", func, ++ "SYSLOG_FACILITY=1", + NULL); + } + } +-- +1.8.3.1 + diff --git a/0003-event-configuration-load-default-values-from-configu.patch b/0003-event-configuration-load-default-values-from-configu.patch new file mode 100644 index 0000000..2268f19 --- /dev/null +++ b/0003-event-configuration-load-default-values-from-configu.patch @@ -0,0 +1,70 @@ +From 19ab2fb879ca3b9fdc975458a7ef9d055caa341c Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Thu, 6 Feb 2014 10:38:51 +0100 +Subject: [LIBREPORT PATCH 3/6] event configuration: load default values from + configuration directory + +Load event configuration files from EVENT_CONF_DIR, where the files are +actually placed, instead of EVENT_DIR, which contains on XML event +definition files. + +Closes rhbz#1062239 + +Signed-off-by: Jakub Filak +--- + augeas/libreport.aug | 3 +++ + src/lib/Makefile.am | 1 + + src/lib/event_config.c | 10 +++++++++- + 3 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/augeas/libreport.aug b/augeas/libreport.aug +index 431d3d2..3eba157 100644 +--- a/augeas/libreport.aug ++++ b/augeas/libreport.aug +@@ -20,7 +20,10 @@ module Libreport = + let lns = ( comment | empty | option )* + + let filter = (incl "/etc/libreport/plugins/*") ++ . (incl "/etc/libreport/events/*") + . (incl (Sys.getenv("HOME") . "/.config/abrt/settings/*")) ++ . (incl (Sys.getenv("XDG_CACHE_HOME") . "/abrt/events/*")) ++ . (incl (Sys.getenv("HOME") . "/.cache/abrt/events/*")) + . Util.stdexcl + + let xfm = transform lns filter +diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am +index a8ae75c..ac173f6 100644 +--- a/src/lib/Makefile.am ++++ b/src/lib/Makefile.am +@@ -64,6 +64,7 @@ libreport_la_CPPFLAGS = \ + -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ + -DCONF_DIR=\"$(CONF_DIR)\" \ + -DEVENTS_DIR=\"$(EVENTS_DIR)\" \ ++ -DEVENTS_CONF_DIR=\"$(EVENTS_CONF_DIR)\" \ + -DWORKFLOWS_DIR=\"$(WORKFLOWS_DIR)\" \ + -DBIN_DIR=\"$(bindir)\" \ + -DDEFAULT_DUMP_DIR_MODE=$(DEFAULT_DUMP_DIR_MODE) \ +diff --git a/src/lib/event_config.c b/src/lib/event_config.c +index 81141f0..76fe4de 100644 +--- a/src/lib/event_config.c ++++ b/src/lib/event_config.c +@@ -229,7 +229,15 @@ GHashTable *load_event_config_data(void) + event_files = g_list_delete_link(event_files, event_files); + } + +- load_config_files(EVENTS_DIR); ++ /* EVENTS_DIR -> /usr/share/libreport/events/$EVENT_NAME.xml ++ * - event xml definition files ++ * ++ * EVENTS_CONF_DIR -> /etc/libreport/events/$EVENT_NAME.conf ++ * - default values for xml definitions ++ * ++ * https://fedorahosted.org/abrt/wiki/AbrtConfiguration#Adjustingpluginconfiguration ++ */ ++ load_config_files(EVENTS_CONF_DIR); + + char *cachedir; + cachedir = concat_path_file(g_get_user_cache_dir(), "abrt/events"); +-- +1.8.3.1 + diff --git a/0004-testsuite-xml-translations.patch b/0004-testsuite-xml-translations.patch new file mode 100644 index 0000000..ac14225 --- /dev/null +++ b/0004-testsuite-xml-translations.patch @@ -0,0 +1,168 @@ +From 5ea5efbc93796be72126149f1d3507e2b1aa0e18 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Fri, 7 Feb 2014 16:19:20 +0100 +Subject: [LIBREPORT PATCH 4/6] testsuite: xml translations + +Related to rhbz#909536 + +Signed-off-by: Jakub Filak +--- + tests/Makefile.am | 3 +- + tests/conf/event_test_definition.xml | 32 ++++++++++++++++++ + tests/conf/workflow_test_definition.xml | 13 +++++++ + tests/testsuite.at | 1 + + tests/xml_definition.at | 60 +++++++++++++++++++++++++++++++++ + 5 files changed, 108 insertions(+), 1 deletion(-) + create mode 100644 tests/conf/event_test_definition.xml + create mode 100644 tests/conf/workflow_test_definition.xml + create mode 100644 tests/xml_definition.at + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index e8af4de..8ec40e1 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -37,7 +37,8 @@ TESTSUITE_AT = \ + configuration_files.at \ + reported_to.at \ + make_description.at \ +- libreport_types.at ++ libreport_types.at \ ++ xml_definition.at + + EXTRA_DIST += $(TESTSUITE_AT) + TESTSUITE = $(srcdir)/testsuite +diff --git a/tests/conf/event_test_definition.xml b/tests/conf/event_test_definition.xml +new file mode 100644 +index 0000000..e12648a +--- /dev/null ++++ b/tests/conf/event_test_definition.xml +@@ -0,0 +1,32 @@ ++ ++ ++ Bugzilla ++ screen name ++ bad screen name ++ ++ Report to Bugzilla bug tracker ++ description ++ bad description ++ ++ Report to Bugzilla bug tracker in long description ++ long description ++ bad long description ++ ++ ++ ++ ++ +diff --git a/tests/conf/workflow_test_definition.xml b/tests/conf/workflow_test_definition.xml +new file mode 100644 +index 0000000..1666c1c +--- /dev/null ++++ b/tests/conf/workflow_test_definition.xml +@@ -0,0 +1,13 @@ ++ ++ ++ Report to Red Hat Customer Portal ++ screen name ++ bad screen name ++ Process the C/C++ crash using the Red Hat infrastructure ++ description ++ bad description ++ ++ ++ collect_* ++ ++ +diff --git a/tests/testsuite.at b/tests/testsuite.at +index 1faccfb..97b2442 100644 +--- a/tests/testsuite.at ++++ b/tests/testsuite.at +@@ -12,3 +12,4 @@ m4_include([configuration_files.at]) + m4_include([reported_to.at]) + m4_include([make_description.at]) + m4_include([libreport_types.at]) ++m4_include([xml_definition.at]) +diff --git a/tests/xml_definition.at b/tests/xml_definition.at +new file mode 100644 +index 0000000..e9cef49 +--- /dev/null ++++ b/tests/xml_definition.at +@@ -0,0 +1,60 @@ ++# -*- Autotest -*- ++ ++AT_BANNER([XML definitions]) ++ ++## ------------------------ ## ++## region_specific_language ## ++## ------------------------ ## ++ ++AT_TESTFUN([region_specific_language], ++[[ ++#include "internal_libreport.h" ++#include ++#include ++#include ++#include ++ ++int main(void) ++{ ++ g_verbose = 3; ++ ++ setlocale(LC_ALL, "zh_CN"); ++ ++ { ++ event_config_t *event_config = new_event_config("event_test_definition"); ++ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml"); ++ assert(strcmp("screen name", ec_get_screen_name(event_config)) == 0); ++ assert(strcmp("description", ec_get_description(event_config)) == 0); ++ assert(strcmp("long description", ec_get_long_desc(event_config)) == 0); ++ ++ assert(event_config->options != NULL || !"At least one event option was loaded"); ++ ++ /* typeof(event_config->options) == (GList *) */ ++ event_option_t *event_option = (event_option_t *)event_config->options->data; ++ assert(strcmp("label", event_option->eo_label) == 0); ++ assert(strcmp("note_html", event_option->eo_note_html) == 0); ++ ++ /* Option description is not supported yet ++ assert(strcmp("description", event_option->eo_description) == 0); ++ */ ++ ++ free_event_config(event_config); ++ } ++ ++ { ++ workflow_t *workflow = new_workflow("workflow_test_definition"); ++ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml"); ++ ++ assert(strcmp("screen name", wf_get_screen_name(workflow)) == 0); ++ assert(strcmp("description", wf_get_description(workflow)) == 0); ++ ++ /* Long description is not supported yet ++ assert(strcmp("long description", wf_get_long_desc(workflow)) == 0); ++ */ ++ ++ free_workflow(workflow); ++ } ++ ++ return EXIT_SUCCESS; ++} ++]]) +-- +1.8.3.1 + diff --git a/0005-testsuite-complex-testing-of-xml-locales.patch b/0005-testsuite-complex-testing-of-xml-locales.patch new file mode 100644 index 0000000..785ecae --- /dev/null +++ b/0005-testsuite-complex-testing-of-xml-locales.patch @@ -0,0 +1,105 @@ +From 07a0003f2bd6121ad7d3ef18e1f3a858baaa20c0 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Sat, 8 Feb 2014 09:14:59 +0100 +Subject: [LIBREPORT PATCH 5/6] testsuite: complex testing of xml locales + +Related to rhbz#909536 + +Signed-off-by: Jakub Filak +--- + tests/xml_definition.at | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 79 insertions(+) + +diff --git a/tests/xml_definition.at b/tests/xml_definition.at +index e9cef49..d3032c9 100644 +--- a/tests/xml_definition.at ++++ b/tests/xml_definition.at +@@ -55,6 +55,85 @@ int main(void) + free_workflow(workflow); + } + ++ setlocale(LC_ALL, "zh_CN.utf8"); ++ ++ { ++ event_config_t *event_config = new_event_config("event_test_definition"); ++ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml"); ++ assert(strcmp("screen name", ec_get_screen_name(event_config)) == 0); ++ assert(strcmp("description", ec_get_description(event_config)) == 0); ++ assert(strcmp("long description", ec_get_long_desc(event_config)) == 0); ++ ++ assert(event_config->options != NULL || !"At least one event option was loaded"); ++ ++ /* typeof(event_config->options) == (GList *) */ ++ event_option_t *event_option = (event_option_t *)event_config->options->data; ++ assert(strcmp("label", event_option->eo_label) == 0); ++ assert(strcmp("note_html", event_option->eo_note_html) == 0); ++ ++ /* Option description is not supported yet ++ assert(strcmp("description", event_option->eo_description) == 0); ++ */ ++ ++ free_event_config(event_config); ++ } ++ ++ { ++ workflow_t *workflow = new_workflow("workflow_test_definition"); ++ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml"); ++ ++ assert(strcmp("screen name", wf_get_screen_name(workflow)) == 0); ++ assert(strcmp("description", wf_get_description(workflow)) == 0); ++ ++ /* Long description is not supported yet ++ assert(strcmp("long description", wf_get_long_desc(workflow)) == 0); ++ */ ++ ++ free_workflow(workflow); ++ } ++ ++ /* ++ XML definitions does not contain strings for zh_HK but there are strings ++ for zh_CN and followed by zh_TW. libreport should you string for zh_TW ++ and these strings are prefixed with "bad " string. ++ */ ++ setlocale(LC_ALL, "zh_HK"); ++ ++ { ++ event_config_t *event_config = new_event_config("event_test_definition"); ++ load_event_description_from_file(event_config, "../../conf/event_test_definition.xml"); ++ assert(strcmp("bad screen name", ec_get_screen_name(event_config)) == 0); ++ assert(strcmp("bad description", ec_get_description(event_config)) == 0); ++ assert(strcmp("bad long description", ec_get_long_desc(event_config)) == 0); ++ ++ assert(event_config->options != NULL || !"At least one event option was loaded"); ++ ++ /* typeof(event_config->options) == (GList *) */ ++ event_option_t *event_option = (event_option_t *)event_config->options->data; ++ assert(strcmp("bad label", event_option->eo_label) == 0); ++ assert(strcmp("bad note_html", event_option->eo_note_html) == 0); ++ ++ /* Option description is not supported yet ++ assert(strcmp("description", event_option->eo_description) == 0); ++ */ ++ ++ free_event_config(event_config); ++ } ++ ++ { ++ workflow_t *workflow = new_workflow("workflow_test_definition"); ++ load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml"); ++ ++ assert(strcmp("bad screen name", wf_get_screen_name(workflow)) == 0); ++ assert(strcmp("bad description", wf_get_description(workflow)) == 0); ++ ++ /* Long description is not supported yet ++ assert(strcmp("bad long description", wf_get_long_desc(workflow)) == 0); ++ */ ++ ++ free_workflow(workflow); ++ } ++ + return EXIT_SUCCESS; + } + ]]) +-- +1.8.3.1 + diff --git a/0006-localization-properly-handle-locales-with-encoding-s.patch b/0006-localization-properly-handle-locales-with-encoding-s.patch new file mode 100644 index 0000000..fa678de --- /dev/null +++ b/0006-localization-properly-handle-locales-with-encoding-s.patch @@ -0,0 +1,89 @@ +From e652d1c2604eac52b622ded3839e94bc742a5c50 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Sat, 8 Feb 2014 09:15:35 +0100 +Subject: [LIBREPORT PATCH 6/6] localization: properly handle locales with + encoding suffix + +XML nodes contain xml:lang attributes whose values are plain language +codes (en_GB, zh_CN, ...). + +libreport tries to find exact match with cur locale which may be +suffixed with char set identifier (.UTF-8). Therefore libreport never +finds exact match. + +This patch removes the encoding suffix from cur locale string. + +Related to rhbz#909536 + +Signed-off-by: Jakub Filak +--- + src/include/xml_parser.h | 2 +- + src/lib/event_xml_parser.c | 6 ++++-- + src/lib/workflow_xml_parser.c | 4 +++- + 3 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/include/xml_parser.h b/src/include/xml_parser.h +index 59517b3..36fd2ae 100644 +--- a/src/include/xml_parser.h ++++ b/src/include/xml_parser.h +@@ -22,7 +22,7 @@ + struct my_parse_data + { + workflow_t *workflow; +- const char *cur_locale; ++ char *cur_locale; + char *attribute_lang; + bool in_event_list; + bool exact_name; +diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c +index 2a6f477..1f98158 100644 +--- a/src/lib/event_xml_parser.c ++++ b/src/lib/event_xml_parser.c +@@ -60,7 +60,7 @@ struct my_parse_data + { + parsed_event_config_t event_config; + parsed_event_option_t cur_option; +- const char *cur_locale; ++ char *cur_locale; + char *attribute_lang; + bool in_adv_option; + }; +@@ -511,7 +511,8 @@ void load_event_description_from_file(event_config_t *event_config, const char* + { + log_notice("loading event: '%s'", filename); + struct my_parse_data parse_data = { {event_config, false, false, false}, {NULL, false, false}, NULL, NULL }; +- parse_data.cur_locale = setlocale(LC_ALL, NULL); ++ parse_data.cur_locale = xstrdup(setlocale(LC_ALL, NULL)); ++ strchrnul(parse_data.cur_locale, '.')[0] = '\0'; + + GMarkupParser parser; + memset(&parser, 0, sizeof(parser)); /* just in case */ +@@ -541,4 +542,5 @@ void load_event_description_from_file(event_config_t *event_config, const char* + + consume_cur_option(&parse_data); /* just in case */ + free(parse_data.attribute_lang); /* just in case */ ++ free(parse_data.cur_locale); + } +diff --git a/src/lib/workflow_xml_parser.c b/src/lib/workflow_xml_parser.c +index 681b171..0efc733 100644 +--- a/src/lib/workflow_xml_parser.c ++++ b/src/lib/workflow_xml_parser.c +@@ -165,7 +165,8 @@ void load_workflow_description_from_file(workflow_t *workflow, const char* filen + { + log_notice("loading workflow: '%s'", filename); + struct my_parse_data parse_data = { workflow, NULL, NULL, 0, 0, 0}; +- parse_data.cur_locale = setlocale(LC_ALL, NULL); ++ parse_data.cur_locale = xstrdup(setlocale(LC_ALL, NULL)); ++ strchrnul(parse_data.cur_locale, '.')[0] = '\0'; + + GMarkupParser parser; + memset(&parser, 0, sizeof(parser)); /* just in case */ +@@ -194,4 +195,5 @@ void load_workflow_description_from_file(workflow_t *workflow, const char* filen + g_markup_parse_context_free(context); + + free(parse_data.attribute_lang); /* just in case */ ++ free(parse_data.cur_locale); + } +-- +1.8.3.1 + diff --git a/libreport.spec b/libreport.spec index 84c9545..4a770ae 100644 --- a/libreport.spec +++ b/libreport.spec @@ -7,13 +7,22 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.1.12 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Libraries URL: https://fedorahosted.org/abrt/ Source: https://fedorahosted.org/released/abrt/%{name}-%{version}.tar.gz Source1: autogen.sh +Patch0002: 0002-Provide-SYSLOG_FACILITY-when-logging-through-journal.patch +Patch0003: 0003-event-configuration-load-default-values-from-configu.patch +Patch0004: 0004-testsuite-xml-translations.patch +Patch0005: 0005-testsuite-complex-testing-of-xml-locales.patch +Patch0006: 0006-localization-properly-handle-locales-with-encoding-s.patch + +# '%%autosetup -S git' -> git +BuildRequires: git + BuildRequires: dbus-devel BuildRequires: gtk3-devel BuildRequires: curl-devel @@ -280,7 +289,12 @@ Default configuration for reporting Anaconda problems or uploading the gathered data over ftp/scp... %prep -%setup -q +# http://www.rpm.org/wiki/PackagerDocs/Autosetup +# Default '__scm_apply_git' is 'git apply && git commit' but this workflow +# doesn't allow us to create a new file within a patch, so we have to use +# 'git am' (see /usr/lib/rpm/macros for more details) +%define __scm_apply_git(qp:m:) %{__git} am +%autosetup -S git # koji in f19 has new autotools, so we need to regenerate everything cp %SOURCE1 %_builddir/%{name}-%{version} @@ -614,6 +628,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog +* Mon Feb 10 2014 Jakub Filak 2.1.12-2 +- fix loading of localized strings from XML files +- fix loading of default event configuration files +- provide SYSLOG_FACILITY when logging through journal + * Thu Jan 30 2014 Jakub Filak 2.1.12-1 - fix loading of the user list of ignored words - report-cli: use the Client API for communication to user