2.0.1-0.2.rc3 - Fix buildability with GCC 9 (PR #1681)

Apply minor crm_mon XML output fix (PR #1678)

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
Jan Pokorný 2019-01-22 13:34:01 +01:00
parent 8a22ec78ab
commit 885ffa47ae
No known key found for this signature in database
GPG Key ID: 61BBB23A9E8F8DE2
3 changed files with 165 additions and 4 deletions

View File

@ -0,0 +1,69 @@
From abb6feeb39c027aa0c3f973ef93e3524ea866936 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Mon, 21 Jan 2019 13:40:44 +0100
Subject: [PATCH] Fix: crm_mon: remove duplicity of fence-action-state in
xml-output
and unnecessary conditionals making code less readable that were
probably introduced rearranging the code.
rhbz#1667191
---
tools/crm_mon.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
index aad9b719b4..bc161aac33 100644
--- a/tools/crm_mon.c
+++ b/tools/crm_mon.c
@@ -3175,7 +3175,7 @@ print_stonith_action(FILE *stream, stonith_history_t *event)
fprintf(stream, " completed=\"%s\"", run_at_s?run_at_s:"");
break;
default:
- fprintf(stream, " state=\"pending\"");
+ break;
}
fprintf(stream, " />\n");
break;
@@ -3189,8 +3189,7 @@ print_stonith_action(FILE *stream, stonith_history_t *event)
action_s, event->target,
event->delegate ? event->delegate : "",
event->client, event->origin,
- ((!fence_full_history) && (output_format != mon_output_xml))?
- "last-successful":"completed",
+ fence_full_history?"completed":"last-successful",
run_at_s?run_at_s:"");
break;
case st_failed:
@@ -3199,8 +3198,7 @@ print_stonith_action(FILE *stream, stonith_history_t *event)
action_s, event->target,
event->delegate ? event->delegate : "",
event->client, event->origin,
- ((!fence_full_history) && (output_format != mon_output_xml))?
- "last-failed":"completed",
+ fence_full_history?"completed":"last-failed",
run_at_s?run_at_s:"");
break;
default:
@@ -3219,9 +3217,7 @@ print_stonith_action(FILE *stream, stonith_history_t *event)
action_s, event->target,
event->delegate ? event->delegate : "",
event->client, event->origin,
- ((!fence_full_history) &&
- (output_format != mon_output_xml))?
- "last-successful":"completed",
+ fence_full_history?"completed":"last-successful",
run_at_s?run_at_s:"");
break;
case st_failed:
@@ -3230,9 +3226,7 @@ print_stonith_action(FILE *stream, stonith_history_t *event)
action_s, event->target,
event->delegate ? event->delegate : "",
event->client, event->origin,
- ((!fence_full_history) &&
- (output_format != mon_output_xml))?
- "last-failed":"completed",
+ fence_full_history?"completed":"last-failed",
run_at_s?run_at_s:"");
break;
default:

View File

@ -0,0 +1,86 @@
From a2e873635db3dfbb696527372dfaad9f58621f48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Mon, 21 Jan 2019 20:46:56 +0100
Subject: [PATCH] Build: 2 *.c: restore GCC 9 -Werror buildability: avoid NULL
to '%s' arg
Sadly, pacemaker codebase seems to be possibly heavily spoiled with
this undefined behaviour when possibly passing NULL corresponding to
'%s' format specifier argument, so for the time being, fix just what
new GCC 9 started to spot[*] (due to build-time constant NULLs, which
is an immediate proof) since these occurrences boil down to mere
thinkos. Related to that, would be wise to start rolling out
nonnull annotations to preserve more general sanity in this self
explanatory aspect.
Looking at libqb code (end destination of "crm_log" processing), there's
nothing to implicitly mask NULL with a predestined string explicitly
(like glibc make do with "(null)" in majority of the cases), so unless
merely a blackbox is used for logging (qb_vsnprintf_serialize seems to
deal with such a NULL gracefully), passing NULLs where a character array
is expected is rather dangerous without the prior knowledge of
particular libc (vsnprintf) implementation.
[*] https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=gcc/gimple-ssa-sprintf.c;h=456a7d400115713a6600b1ce7bb303b6c971550e;hb=7b2ced2fa2c0597ba083461864c9026c3c9d3720;hpb=b07bf3b9730bebfc9953ea2eeee86a1274e39022
---
daemons/based/based_callbacks.c | 6 +++---
tools/test.iso8601.c | 11 ++++-------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/daemons/based/based_callbacks.c b/daemons/based/based_callbacks.c
index 723e74c876..daef8c7a63 100644
--- a/daemons/based/based_callbacks.c
+++ b/daemons/based/based_callbacks.c
@@ -594,8 +594,8 @@ parse_peer_options_v1(int call_type, xmlNode * request,
return TRUE;
}
- crm_trace("Processing %s request sent by %s", op, originator);
op = crm_element_value(request, F_CIB_OPERATION);
+ crm_trace("Processing %s request sent by %s", op, originator);
if (safe_str_eq(op, "cib_shutdown_req")) {
/* Always process these */
*local_notify = FALSE;
@@ -650,11 +650,11 @@ parse_peer_options_v1(int call_type, xmlNode * request,
} else if (safe_str_eq(op, "cib_shutdown_req")) {
if (reply_to != NULL) {
- crm_debug("Processing %s from %s", op, host);
+ crm_debug("Processing %s from %s", op, originator);
*needs_reply = FALSE;
} else {
- crm_debug("Processing %s reply from %s", op, host);
+ crm_debug("Processing %s reply from %s", op, originator);
}
return TRUE;
diff --git a/tools/test.iso8601.c b/tools/test.iso8601.c
index 6d70af5a4c..93ca4814f6 100644
--- a/tools/test.iso8601.c
+++ b/tools/test.iso8601.c
@@ -8,6 +8,7 @@
#include <crm_internal.h>
#include <crm/crm.h>
#include <crm/common/iso8601.h>
+#include <crm/common/util.h> /* CRM_ASSERT */
#include <unistd.h>
char command = 0;
@@ -46,13 +47,9 @@ static struct crm_option long_options[] = {
static void
log_time_period(int log_level, crm_time_period_t * dtp, int flags)
{
- char *end = NULL;
- char *start = NULL;
-
- if(dtp) {
- start = crm_time_as_string(dtp->start, flags);
- end = crm_time_as_string(dtp->end, flags);
- }
+ char *start = crm_time_as_string(dtp->start, flags);
+ char *end = crm_time_as_string(dtp->end, flags);
+ CRM_ASSERT(start != NULL && end != NULL);
if (log_level < LOG_CRIT) {
printf("Period: %s to %s\n", start, end);

View File

@ -14,7 +14,7 @@
## can be incremented to build packages reliably considered "newer"
## than previously built packages with the same pcmkversion)
%global pcmkversion 2.0.1
%global specversion 1
%global specversion 2
## Upstream commit (or git tag, such as "Pacemaker-" plus the
## {pcmkversion} macro for an official release) to use for this package
@ -145,9 +145,11 @@ Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{na
Source1: https://github.com/%{github_owner}/%{nagios_name}/archive/%{nagios_hash}/%{nagios_name}-%{nagios_hash}.tar.gz
# ---
# patches go here
Patch0: https://github.com/%{github_owner}/%{name}/pull/1677/commits/286569c1a2359a97ad33f77b3b6b63b04d520b76.patch#/10-Revert-Tests-cts-cli-Use-extended-regular-expression.patch
Patch1: https://github.com/%{github_owner}/%{name}/pull/1677/commits/86ba5e63eff051aa01b4872cee97896aecf38ef9.patch#/11-Tests-cts-cli-simplify-fix-regexp-to-catch-crm_time_.patch
#Patch2: .../pull/1677/commits/ef8bd8d29d34a4cea1460bb3e0837996dc08510d.patch#/12-Build-configure-cts_scheduler-allow-skipping-broken-.patch
Patch0: https://github.com/%{github_owner}/%{name}/commit/abb6feeb39c027aa0c3f973ef93e3524ea866936.patch#/00-Fix-crm_mon-remove-duplicity-of-fence-action-state-i.patch
Patch10: https://github.com/%{github_owner}/%{name}/pull/1677/commits/286569c1a2359a97ad33f77b3b6b63b04d520b76.patch#/10-Revert-Tests-cts-cli-Use-extended-regular-expression.patch
Patch11: https://github.com/%{github_owner}/%{name}/pull/1677/commits/86ba5e63eff051aa01b4872cee97896aecf38ef9.patch#/11-Tests-cts-cli-simplify-fix-regexp-to-catch-crm_time_.patch
#Patch12: .../pull/1677/commits/d76a2614ded697fb4adb117e5a6633008c31f60e.patch#/12-Build-configure-cts_scheduler-allow-skipping-broken-.patch
Patch20: https://github.com/ClusterLabs/pacemaker/pull/1681/commits/a2e873635db3dfbb696527372dfaad9f58621f48.patch#/20-Build-2-.c-restore-GCC-9-Werror-buildability-avoid-N.patch
Requires: resource-agents
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -716,6 +718,10 @@ exit 0
%license %{nagios_name}-%{nagios_hash}/COPYING
%changelog
* Tue Jan 22 2019 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 2.0.1-0.2.rc3
- Fix buildability with GCC 9 (PR #1681)
- Apply minor crm_mon XML output fix (PR #1678)
* Sun Jan 20 2019 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 2.0.1-0.1.rc3
- Update for new upstream tarball for release candidate: Pacemaker-2.0.1-rc3,
for full details, see included ChangeLog file or