diff --git a/0002-Low-libcrmcommon-Fix-problems-with-pcmk__output_and_.patch b/0002-Low-libcrmcommon-Fix-problems-with-pcmk__output_and_.patch new file mode 100644 index 0000000..b6dbf4a --- /dev/null +++ b/0002-Low-libcrmcommon-Fix-problems-with-pcmk__output_and_.patch @@ -0,0 +1,402 @@ +From c5b6a64cde5d460e1349e952db6a33831009ecd0 Mon Sep 17 00:00:00 2001 +From: Chris Lumens +Date: Mon, 20 Feb 2023 16:12:19 -0500 +Subject: [PATCH] Low: libcrmcommon: Fix problems with + pcmk__output_and_clear_error. + +First, it should take a GError ** so that doing anything in the function +modifies the error object that was passed to it. Second, the test case +should assert that the error is NULL, not that some element of it is +NULL. + +Backported to 2.1.5 + +diff --git a/daemons/fenced/cts-fence-helper.c b/daemons/fenced/cts-fence-helper.c +index a9260e5c0..e18a1f497 100644 +--- a/daemons/fenced/cts-fence-helper.c ++++ b/daemons/fenced/cts-fence-helper.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2009-2022 the Pacemaker project contributors ++ * Copyright 2009-2023 the Pacemaker project contributors + * + * This source code is licensed under the GNU General Public License version 2 + * or later (GPLv2+) WITHOUT ANY WARRANTY. +@@ -676,6 +676,6 @@ done: + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + crm_exit(exit_code); + } +diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c +index 20ba9ce3c..cc55a6af1 100644 +--- a/daemons/pacemakerd/pacemakerd.c ++++ b/daemons/pacemakerd/pacemakerd.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2010-2022 the Pacemaker project contributors ++ * Copyright 2010-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -449,7 +449,7 @@ done: + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/daemons/schedulerd/pacemaker-schedulerd.c b/daemons/schedulerd/pacemaker-schedulerd.c +index bbe253566..3f2a3e861 100644 +--- a/daemons/schedulerd/pacemaker-schedulerd.c ++++ b/daemons/schedulerd/pacemaker-schedulerd.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2004-2022 the Pacemaker project contributors ++ * Copyright 2004-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -151,7 +151,7 @@ done: + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + pengine_shutdown(0); + } + +diff --git a/include/crm/common/output_internal.h b/include/crm/common/output_internal.h +index 26cd8c42f..e357d9a68 100644 +--- a/include/crm/common/output_internal.h ++++ b/include/crm/common/output_internal.h +@@ -911,7 +911,7 @@ G_GNUC_NULL_TERMINATED; + * \param[in,out] out The output functions structure. If NULL, any errors + * will simply be printed to stderr. + */ +-void pcmk__output_and_clear_error(GError *error, pcmk__output_t *out); ++void pcmk__output_and_clear_error(GError **error, pcmk__output_t *out); + + int pcmk__xml_output_new(pcmk__output_t **out, xmlNodePtr *xml); + void pcmk__xml_output_finish(pcmk__output_t *out, xmlNodePtr *xml); +diff --git a/lib/common/output.c b/lib/common/output.c +index e8d512497..266a14af7 100644 +--- a/lib/common/output.c ++++ b/lib/common/output.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2019-2022 the Pacemaker project contributors ++ * Copyright 2019-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -169,19 +169,19 @@ pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table) + } + + void +-pcmk__output_and_clear_error(GError *error, pcmk__output_t *out) ++pcmk__output_and_clear_error(GError **error, pcmk__output_t *out) + { +- if (error == NULL) { ++ if (error == NULL || *error == NULL) { + return; + } + + if (out != NULL) { +- out->err(out, "%s: %s", g_get_prgname(), error->message); ++ out->err(out, "%s: %s", g_get_prgname(), (*error)->message); + } else { +- fprintf(stderr, "%s: %s\n", g_get_prgname(), error->message); ++ fprintf(stderr, "%s: %s\n", g_get_prgname(), (*error)->message); + } + +- g_clear_error(&error); ++ g_clear_error(error); + } + + /*! +diff --git a/lib/common/tests/output/pcmk__output_and_clear_error_test.c b/lib/common/tests/output/pcmk__output_and_clear_error_test.c +index 182ea9bba..f54ed8a58 100644 +--- a/lib/common/tests/output/pcmk__output_and_clear_error_test.c ++++ b/lib/common/tests/output/pcmk__output_and_clear_error_test.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2022 the Pacemaker project contributors ++ * Copyright 2022-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -72,10 +72,10 @@ standard_usage(void **state) { + "some error message"); + + expect_function_call(fake_text_err); +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + pcmk__output_free(out); +- assert_null(error->message); ++ assert_null(error); + } + + PCMK__UNIT_TEST(NULL, NULL, +diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c +index 16483823a..60e4cc7c5 100644 +--- a/tools/attrd_updater.c ++++ b/tools/attrd_updater.c +@@ -369,7 +369,7 @@ done: + g_free(options.attr_set); + free(options.attr_value); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/tools/crm_attribute.c b/tools/crm_attribute.c +index 21d8f3ae7..358b15039 100644 +--- a/tools/crm_attribute.c ++++ b/tools/crm_attribute.c +@@ -871,7 +871,7 @@ done: + + cib__clean_up_connection(&the_cib); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/tools/crm_diff.c b/tools/crm_diff.c +index 6eeb83b5a..2a973d083 100644 +--- a/tools/crm_diff.c ++++ b/tools/crm_diff.c +@@ -381,6 +381,6 @@ done: + free_xml(object_1); + free_xml(object_2); + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + crm_exit(exit_code); + } +diff --git a/tools/crm_error.c b/tools/crm_error.c +index 9686e4ba6..8911eae1b 100644 +--- a/tools/crm_error.c ++++ b/tools/crm_error.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2012-2022 the Pacemaker project contributors ++ * Copyright 2012-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -164,7 +164,7 @@ main(int argc, char **argv) + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/tools/crm_node.c b/tools/crm_node.c +index f4e671f05..ac2a19022 100644 +--- a/tools/crm_node.c ++++ b/tools/crm_node.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2004-2022 the Pacemaker project contributors ++ * Copyright 2004-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -596,6 +596,6 @@ done: + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + return crm_exit(exit_code); + } +diff --git a/tools/crm_resource.c b/tools/crm_resource.c +index 4a89c647d..0134d5629 100644 +--- a/tools/crm_resource.c ++++ b/tools/crm_resource.c +@@ -200,7 +200,7 @@ static pcmk__supported_format_t formats[] = { + static crm_exit_t + bye(crm_exit_t ec) + { +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, ec, true, NULL); +diff --git a/tools/crm_rule.c b/tools/crm_rule.c +index 5d9cb5148..5cdc118c5 100644 +--- a/tools/crm_rule.c ++++ b/tools/crm_rule.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2019-2022 the Pacemaker project contributors ++ * Copyright 2019-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -215,7 +215,7 @@ done: + crm_time_free(rule_date); + free_xml(input); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/tools/crm_simulate.c b/tools/crm_simulate.c +index ff2b6f40b..932c5bd22 100644 +--- a/tools/crm_simulate.c ++++ b/tools/crm_simulate.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2009-2022 the Pacemaker project contributors ++ * Copyright 2009-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -547,7 +547,7 @@ main(int argc, char **argv) + options.dot_file); + + done: +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + + /* There sure is a lot to free in options. */ + free(options.dot_file); +diff --git a/tools/crm_ticket.c b/tools/crm_ticket.c +index 15b615c6c..d768818e1 100644 +--- a/tools/crm_ticket.c ++++ b/tools/crm_ticket.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2012-2022 the Pacemaker project contributors ++ * Copyright 2012-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -1005,7 +1005,7 @@ main(int argc, char **argv) + g_free(options.ticket_id); + g_free(options.xml_file); + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + + crm_exit(exit_code); + } +diff --git a/tools/crm_verify.c b/tools/crm_verify.c +index 357cba888..43b09da4b 100644 +--- a/tools/crm_verify.c ++++ b/tools/crm_verify.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2004-2022 the Pacemaker project contributors ++ * Copyright 2004-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -273,7 +273,7 @@ main(int argc, char **argv) + exit_code = pcmk_rc2exitc(rc); + } + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/tools/crmadmin.c b/tools/crmadmin.c +index 577e94155..0b400ae6c 100644 +--- a/tools/crmadmin.c ++++ b/tools/crmadmin.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2004-2022 the Pacemaker project contributors ++ * Copyright 2004-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -264,7 +264,7 @@ done: + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +diff --git a/tools/iso8601.c b/tools/iso8601.c +index 002eb5ad0..e53bca021 100644 +--- a/tools/iso8601.c ++++ b/tools/iso8601.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2005-2022 the Pacemaker project contributors ++ * Copyright 2005-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -277,6 +277,6 @@ done: + g_free(options.expected_s); + g_free(options.period_s); + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + crm_exit(exit_code); + } +diff --git a/tools/stonith_admin.c b/tools/stonith_admin.c +index b676200db..1077de770 100644 +--- a/tools/stonith_admin.c ++++ b/tools/stonith_admin.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2009-2022 the Pacemaker project contributors ++ * Copyright 2009-2023 the Pacemaker project contributors + * + * The version control history for this file may have further details. + * +@@ -655,7 +655,7 @@ main(int argc, char **argv) + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, exit_code, true, NULL); +-- +2.39.0 + +diff --git a/daemons/attrd/pacemaker-attrd.c b/daemons/attrd/pacemaker-attrd.c +index 2100db43b..7cbc26ca4 100644 +--- a/daemons/attrd/pacemaker-attrd.c ++++ b/daemons/attrd/pacemaker-attrd.c +@@ -306,7 +306,7 @@ main(int argc, char **argv) + g_strfreev(processed_args); + pcmk__free_arg_context(context); + +- pcmk__output_and_clear_error(error, out); ++ pcmk__output_and_clear_error(&error, out); + + if (out != NULL) { + out->finish(out, attrd_exit_status, true, NULL); +diff --git a/daemons/execd/cts-exec-helper.c b/daemons/execd/cts-exec-helper.c +index cba388fe1..82492b937 100644 +--- a/daemons/execd/cts-exec-helper.c ++++ b/daemons/execd/cts-exec-helper.c +@@ -620,6 +620,6 @@ done: + free(key); + free(val); + +- pcmk__output_and_clear_error(error, NULL); ++ pcmk__output_and_clear_error(&error, NULL); + return test_exit(exit_code); + } diff --git a/pacemaker.spec b/pacemaker.spec index fe98ebf..fa61f98 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -32,7 +32,7 @@ ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 2.1.5 -%global specversion 4 +%global specversion 5 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit a3f44794f94e1571c6ba0042915ade369b4ce4b1 @@ -191,7 +191,7 @@ Name: pacemaker Summary: Scalable High-Availability cluster resource manager Version: %{pcmkversion} -Release: %{pcmk_release}%{?dist}.1 +Release: %{pcmk_release}%{?dist} License: GPLv2+ and LGPLv2+ Url: https://www.clusterlabs.org/ @@ -208,6 +208,7 @@ Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz # upstream commits Patch0: 0001-Fix-fenced-use-enum-fenced_target_by-consistently.patch +Patch1: 0002-Low-libcrmcommon-Fix-problems-with-pcmk__output_and_.patch Requires: resource-agents Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} @@ -799,6 +800,9 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Wed Mar 1 2023 Klaus Wenninger - 2.1.5-5 +- fix pcmk__output_and_clear_error + * Thu Jan 19 2023 Fedora Release Engineering - 2.1.5-4.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild