From b7a5778148fc6d3ad5b1988f9a88445eec50aaa9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Thu, 4 Nov 2021 00:13:36 -0400 Subject: [PATCH] import libreport-2.15.2-5.el9_b --- ...01-Change-the-default-Bugzilla-group.patch | 48 ++++++++ ...-bit-more-defensive-when-working-wit.patch | 48 ++++++++ ...RPC-calls-when-uploading-attachments.patch | 113 ++++++++++++++++++ SPECS/libreport.spec | 19 ++- 4 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 SOURCES/0001-Change-the-default-Bugzilla-group.patch create mode 100644 SOURCES/0002-rhbz-Be-a-little-bit-more-defensive-when-working-wit.patch create mode 100644 SOURCES/0003-rhbz-Retry-XML-RPC-calls-when-uploading-attachments.patch diff --git a/SOURCES/0001-Change-the-default-Bugzilla-group.patch b/SOURCES/0001-Change-the-default-Bugzilla-group.patch new file mode 100644 index 0000000..8f263d6 --- /dev/null +++ b/SOURCES/0001-Change-the-default-Bugzilla-group.patch @@ -0,0 +1,48 @@ +From 3389fbeb5cf00fd515049a6a9db3c5cc4ca383a0 Mon Sep 17 00:00:00 2001 +From: Michal Srb +Date: Thu, 26 Aug 2021 19:20:52 +0200 +Subject: [PATCH] Change the default Bugzilla group + +Signed-off-by: Michal Srb +--- + configure.ac | 6 +++--- + src/plugins/bugzilla.conf | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index fa97fa78..aa383083 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -98,14 +98,14 @@ AC_PATH_PROG([XMLRPC], [xmlrpc-c-config], [no]) + AC_ARG_WITH([redhatbugzillacreateprivate], + AS_HELP_STRING([--with-redhatbugzillacreateprivate="yes/no"], + [Whether the Red Hat Bugzilla plugin should open +- bugs private by default ("no")]), +- [], [with_redhatbugzillacreateprivate="no"]) ++ bugs private by default ("yes")]), ++ [], [with_redhatbugzillacreateprivate="yes"]) + AC_SUBST([RED_HAT_BUGZILLA_CREATE_PRIVATE], [$with_redhatbugzillacreateprivate]) + + AC_ARG_WITH([redhatbugzillaprivategroups], + AS_HELP_STRING([--with-redhatbugzillaprivategroups="CSV"], + [Name of groups separated by comma]), +- [], [with_redhatbugzillaprivategroups="fedora_contrib_private"]) ++ [], [with_redhatbugzillaprivategroups="redhat"]) + AC_SUBST([RED_HAT_BUGZILLA_PRIVATE_GROUPS], [$with_redhatbugzillaprivategroups]) + + +diff --git a/src/plugins/bugzilla.conf b/src/plugins/bugzilla.conf +index a7727392..dbbbd05c 100644 +--- a/src/plugins/bugzilla.conf ++++ b/src/plugins/bugzilla.conf +@@ -22,5 +22,5 @@ Password = + DontMatchComponents = selinux-policy + + # for more info about these settings see: https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets +-# CreatePrivate = no +-# PrivateGroups = fedora_contrib_private ++# CreatePrivate = yes ++# PrivateGroups = redhat +-- +2.31.1 + diff --git a/SOURCES/0002-rhbz-Be-a-little-bit-more-defensive-when-working-wit.patch b/SOURCES/0002-rhbz-Be-a-little-bit-more-defensive-when-working-wit.patch new file mode 100644 index 0000000..a218eaa --- /dev/null +++ b/SOURCES/0002-rhbz-Be-a-little-bit-more-defensive-when-working-wit.patch @@ -0,0 +1,48 @@ +From 50fdc7f23f35744ffff1763fe2d804b18c1c5340 Mon Sep 17 00:00:00 2001 +From: Michal Srb +Date: Tue, 7 Sep 2021 14:40:21 +0200 +Subject: [PATCH] [rhbz] Be a little bit more defensive when working with + subcomponents + +Components in RHEL can have "subcomponents" in Bugzilla. Some of them +have, some of them don't. Better be careful. + +See: rhbz#1998435 + +Signed-off-by: Michal Srb +--- + src/plugins/rhbz.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c +index c2855a70..0dae1e93 100644 +--- a/src/plugins/rhbz.c ++++ b/src/plugins/rhbz.c +@@ -1036,13 +1036,17 @@ char *rhbz_get_default_sub_component(const char *component, xmlrpc_value *sub_co + } + else + { +- xmlrpc_array_read_item(&env, sub_components, sc_array_size - 1, &sc_struct); +- xmlrpc_struct_find_value(&env, sc_struct, "name", &sc_name); +- xmlrpc_read_string(&env, sc_name, &sc_str_name); +- if (sc_struct) +- xmlrpc_DECREF(sc_struct); +- if (sc_name) +- xmlrpc_DECREF(sc_name); ++ if (sc_array_size) { ++ xmlrpc_array_read_item(&env, sub_components, sc_array_size - 1, &sc_struct); ++ if (xmlrpc_struct_has_key(&env, sc_struct, "name")) { ++ xmlrpc_struct_find_value(&env, sc_struct, "name", &sc_name); ++ xmlrpc_read_string(&env, sc_name, &sc_str_name); ++ } ++ if (sc_struct) ++ xmlrpc_DECREF(sc_struct); ++ if (sc_name) ++ xmlrpc_DECREF(sc_name); ++ } + } + + return (char *)sc_str_name; +-- +2.31.1 + diff --git a/SOURCES/0003-rhbz-Retry-XML-RPC-calls-when-uploading-attachments.patch b/SOURCES/0003-rhbz-Retry-XML-RPC-calls-when-uploading-attachments.patch new file mode 100644 index 0000000..5539c03 --- /dev/null +++ b/SOURCES/0003-rhbz-Retry-XML-RPC-calls-when-uploading-attachments.patch @@ -0,0 +1,113 @@ +From 28a6267c056d43cdbf8cd3e10e69d8ab113e74f8 Mon Sep 17 00:00:00 2001 +From: Michal Srb +Date: Tue, 7 Sep 2021 21:31:21 +0200 +Subject: [PATCH] [rhbz] Retry XML-RPC calls when uploading attachments + +If there is a bot that automatically modifies newly opened bugs, then +it can lead to "query serialization error" from Bugzilla. Retry should +help us here. + +Signed-off-by: Michal Srb +--- + src/lib/abrt_xmlrpc.c | 34 ++++++++++++++++++++++++++++++++++ + src/lib/abrt_xmlrpc.h | 5 +++++ + src/lib/libreport-web.sym | 1 + + src/plugins/rhbz.c | 4 +++- + 4 files changed, 43 insertions(+), 1 deletion(-) + +diff --git a/src/lib/abrt_xmlrpc.c b/src/lib/abrt_xmlrpc.c +index 7cac9253..4c3b469a 100644 +--- a/src/lib/abrt_xmlrpc.c ++++ b/src/lib/abrt_xmlrpc.c +@@ -16,6 +16,7 @@ + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ ++#include + #include "internal_libreport.h" + #include "abrt_xmlrpc.h" + #include "proxies.h" +@@ -301,3 +302,36 @@ xmlrpc_value *abrt_xmlrpc_call(struct abrt_xmlrpc *ax, + + return result; + } ++ ++/* die eventually or return expected results; retry up to 5 times if the error is known */ ++xmlrpc_value *abrt_xmlrpc_call_with_retry(const char *fault_substring, ++ struct abrt_xmlrpc *ax, ++ const char *method, ++ const char *format, ...) ++{ ++ int retry_counter = 0; ++ xmlrpc_env env; ++ ++ va_list args; ++ ++ do { ++ // sleep, if this is not the first try; ++ // sleep() can be interrupted, but that's not a big deal here ++ if (retry_counter) ++ sleep(retry_counter); ++ ++ va_start(args, format); ++ xmlrpc_value *result = abrt_xmlrpc_call_full_va(&env, ax, method, format, args); ++ va_end(args); ++ ++ if (!env.fault_occurred) ++ return result; // success! ++ ++ if (env.fault_string && !strstr(env.fault_string, fault_substring)) { ++ // unknown error, don't bother retrying... ++ abrt_xmlrpc_die(&env); ++ } ++ } while (++retry_counter <= 5); ++ ++ abrt_xmlrpc_die(&env); ++} +diff --git a/src/lib/abrt_xmlrpc.h b/src/lib/abrt_xmlrpc.h +index 31768ffc..8ddcfc54 100644 +--- a/src/lib/abrt_xmlrpc.h ++++ b/src/lib/abrt_xmlrpc.h +@@ -63,6 +63,11 @@ xmlrpc_value *abrt_xmlrpc_call_params(xmlrpc_env *env, struct abrt_xmlrpc *ax, + xmlrpc_value *abrt_xmlrpc_call_full(xmlrpc_env *enf, struct abrt_xmlrpc *ax, + const char *method, const char *format, ...); + ++xmlrpc_value *abrt_xmlrpc_call_with_retry(const char *fault_substring, ++ struct abrt_xmlrpc *ax, ++ const char *method, ++ const char *format, ...); ++ + #ifdef __cplusplus + } + #endif +diff --git a/src/lib/libreport-web.sym b/src/lib/libreport-web.sym +index 44f5244d..9ab88d3e 100644 +--- a/src/lib/libreport-web.sym ++++ b/src/lib/libreport-web.sym +@@ -51,6 +51,7 @@ global: + abrt_xmlrpc_call; + abrt_xmlrpc_call_params; + abrt_xmlrpc_call_full; ++ abrt_xmlrpc_call_with_retry; + + /* internal_libreport.h - these symbols are only to be used by libreport developers */ + libreport_trim_all_whitespace; +diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c +index 0dae1e93..f252f914 100644 +--- a/src/plugins/rhbz.c ++++ b/src/plugins/rhbz.c +@@ -643,8 +643,10 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *bug_id, + * i -> integer, single argument (int value) + * 6 -> base64, two arguments (char* plain data which will be encoded by xmlrpc-c to base64, + * size_t number of bytes to encode) ++ * ++ * Retry if another user/bot attempted to change the same data. + */ +- result = abrt_xmlrpc_call(ax, "Bug.add_attachment", "{s:(s),s:s,s:s,s:s,s:6,s:i}", ++ result = abrt_xmlrpc_call_with_retry("query serialization error", ax, "Bug.add_attachment", "{s:(s),s:s,s:s,s:s,s:6,s:i}", + "ids", bug_id, + "summary", fn, + "file_name", filename, +-- +2.31.1 + diff --git a/SPECS/libreport.spec b/SPECS/libreport.spec index a692953..c5c5fe0 100644 --- a/SPECS/libreport.spec +++ b/SPECS/libreport.spec @@ -15,10 +15,13 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.15.2 -Release: 2%{?dist} +Release: 5%{?dist} License: GPLv2+ URL: https://abrt.readthedocs.org/ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz +Patch1: 0001-Change-the-default-Bugzilla-group.patch +Patch2: 0002-rhbz-Be-a-little-bit-more-defensive-when-working-wit.patch +Patch3: 0003-rhbz-Retry-XML-RPC-calls-when-uploading-attachments.patch BuildRequires: %{dbus_devel} BuildRequires: gtk3-devel BuildRequires: curl-devel @@ -277,7 +280,7 @@ data over ftp/scp... %endif %prep -%autosetup +%autosetup -p 1 %build ./autogen.sh @@ -652,6 +655,18 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %endif %changelog +* Tue Sep 07 2021 Michal Srb - 2.15.2-5 +- [reporter-bugzilla] Retry XML-RPC calls +- Related: rhbz#1998210 + +* Tue Sep 07 2021 Michal Srb - 2.15.2-4 +- [reporter-bugzilla] Fix subcomponent handling +- Related: rhbz#1998210 + +* Thu Aug 26 2021 Michal Srb - 2.15.2-3 +- Change the default Bugzilla group +- Resolves: rhbz#1998210 + * Mon Aug 09 2021 Mohan Boddu - 2.15.2-2 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688