diff --git a/Build-restore-buildability-in-the-face-of-obsolete-ftime.patch b/Build-restore-buildability-in-the-face-of-obsolete-ftime.patch deleted file mode 100644 index f1d63d9..0000000 --- a/Build-restore-buildability-in-the-face-of-obsolete-ftime.patch +++ /dev/null @@ -1,304 +0,0 @@ -From 00076ab6adeaf5f28b2f3b233cf6e41bc70bc89e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= -Date: Thu, 14 Nov 2019 17:31:47 +0100 -Subject: [PATCH] Build: restore buildability in the face of obsolete ftime(3) - -Since the usage of ftime(3) used to be opt-in only and since -clock_gettime(3) is mandated with POSIX 2001, we can simply -look at whether CLOCK_MONOTONIC is defined to be used as an -identifier for the particular clock (kind exactly suitable -for this context). Dropping some old cruft being a bonus. -Restores out-of-the-box buildability with recent enough glibc. - -References: -https://sourceware.org/git/?p=glibc.git;a=commit;h=2b5fea833bcd0f651579afd16ed7842770ecbae1 -https://src.fedoraproject.org/rpms/glibc/c/ebf75398f06dd27357d8a5321e8e5959633b8182?branch=master -(for a Fedora Rawhide follow-the-upstream update that lead to this -discovery) ---- - configure.ac | 23 +++++---- - daemons/execd/Makefile.am | 2 +- - daemons/execd/execd_commands.c | 89 ++++++++++++++++++---------------- - 3 files changed, 60 insertions(+), 54 deletions(-) - -diff --git a/configure.ac b/configure.ac -index bd92b803f..f732613b9 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -875,19 +875,15 @@ else - LIBADD_DL=${lt_cv_dlopen_libs} - fi - --dnl FreeBSD needs -lcompat for ftime() used by lrmd.c --AC_CHECK_LIB([compat], [ftime], [COMPAT_LIBS='-lcompat']) --AC_SUBST(COMPAT_LIBS) -- - dnl ======================================================================== - dnl Headers - dnl ======================================================================== - --dnl Some distributions insert #warnings into deprecated headers such as --dnl timeb.h. If we will enable fatal warnings for the build, then enable --dnl them for the header checks as well, otherwise the build could fail --dnl even though the header check succeeds. (We should probably be doing --dnl this in more places.) -+# Some distributions insert #warnings into deprecated headers such as -+# timeb.h used at some point in past. If we will enable fatal warnings -+# for the build, then enable them for the header checks as well, otherwise -+# the build could fail even though the header check succeeds. -+# (We should probably be doing this in more places.) - if test "x${enable_fatal_warnings}" = xyes ; then - cc_temp_flags "$CFLAGS $WERROR" - fi -@@ -923,7 +919,6 @@ AC_CHECK_HEADERS(sys/signalfd.h) - AC_CHECK_HEADERS(sys/sockio.h) - AC_CHECK_HEADERS(sys/stat.h) - AC_CHECK_HEADERS(sys/time.h) --AC_CHECK_HEADERS(sys/timeb.h) - AC_CHECK_HEADERS(sys/types.h) - AC_CHECK_HEADERS(sys/utsname.h) - AC_CHECK_HEADERS(sys/wait.h) -@@ -961,6 +956,14 @@ if test "$pf_cv_var_progname" = "yes"; then - AC_DEFINE(HAVE___PROGNAME,1,[ ]) - fi - -+dnl ======================================================================== -+dnl Generic declarations -+dnl ======================================================================== -+ -+AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[ -+ #include -+]]) -+ - dnl ======================================================================== - dnl Structures - dnl ======================================================================== -diff --git a/daemons/execd/Makefile.am b/daemons/execd/Makefile.am -index 210a7842f..54c9ad492 100644 ---- a/daemons/execd/Makefile.am -+++ b/daemons/execd/Makefile.am -@@ -26,7 +26,7 @@ pacemaker_execd_LDFLAGS = $(LDFLAGS_HARDENED_EXE) - - pacemaker_execd_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \ - $(top_builddir)/lib/services/libcrmservice.la \ -- $(top_builddir)/lib/fencing/libstonithd.la ${COMPAT_LIBS} -+ $(top_builddir)/lib/fencing/libstonithd.la - pacemaker_execd_SOURCES = pacemaker-execd.c execd_commands.c \ - execd_alerts.c - -diff --git a/daemons/execd/execd_commands.c b/daemons/execd/execd_commands.c -index 2d0917d9b..b733e6b1f 100644 ---- a/daemons/execd/execd_commands.c -+++ b/daemons/execd/execd_commands.c -@@ -10,6 +10,11 @@ - #include - - #include -+ -+#if HAVE_DECL_CLOCK_MONOTONIC -+#include /* clock_gettime */ -+#endif -+ - #include - - #include -@@ -21,10 +26,6 @@ - - #include "pacemaker-execd.h" - --#ifdef HAVE_SYS_TIMEB_H --# include --#endif -- - #define EXIT_REASON_MAX_LEN 128 - - GHashTable *rsc_list = NULL; -@@ -57,16 +58,16 @@ typedef struct lrmd_cmd_s { - char *output; - char *userdata_str; - --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - /* Recurring and systemd operations may involve more than one executor - * command per operation, so they need info about the original and the most - * recent. - */ -- struct timeb t_first_run; /* Timestamp of when op first ran */ -- struct timeb t_run; /* Timestamp of when op most recently ran */ -- struct timeb t_first_queue; /* Timestamp of when op first was queued */ -- struct timeb t_queue; /* Timestamp of when op most recently was queued */ -- struct timeb t_rcchange; /* Timestamp of last rc change */ -+ struct timespec t_first_run; /* Timestamp of when op first ran */ -+ struct timespec t_run; /* Timestamp of when op most recently ran */ -+ struct timespec t_first_queue; /* Timestamp of when op first was queued */ -+ struct timespec t_queue; /* Timestamp of when op most recently was queued */ -+ struct timespec t_rcchange; /* Timestamp of last rc change */ - #endif - - int first_notify_sent; -@@ -94,7 +95,7 @@ log_finished(lrmd_cmd_t * cmd, int exec_time, int queue_time) - if (safe_str_eq(cmd->action, "monitor")) { - log_level = LOG_DEBUG; - } --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - do_crm_log(log_level, - "finished - rsc:%s action:%s call_id:%d %s%s exit-code:%d exec-time:%dms queue-time:%dms", - cmd->rsc_id, cmd->action, cmd->call_id, cmd->last_pid ? "pid:" : "", pid_str, -@@ -233,9 +234,9 @@ stonith_recurring_op_helper(gpointer data) - * to be executed */ - rsc->recurring_ops = g_list_remove(rsc->recurring_ops, cmd); - rsc->pending_ops = g_list_append(rsc->pending_ops, cmd); --#ifdef HAVE_SYS_TIMEB_H -- ftime(&cmd->t_queue); -- if (cmd->t_first_queue.time == 0) { -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) -+ clock_gettime(CLOCK_MONOTONIC, &cmd->t_queue); -+ if (cmd->t_first_queue.tv_sec == 0) { - cmd->t_first_queue = cmd->t_queue; - } - #endif -@@ -360,9 +361,9 @@ schedule_lrmd_cmd(lrmd_rsc_t * rsc, lrmd_cmd_t * cmd) - } - - rsc->pending_ops = g_list_append(rsc->pending_ops, cmd); --#ifdef HAVE_SYS_TIMEB_H -- ftime(&cmd->t_queue); -- if (cmd->t_first_queue.time == 0) { -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) -+ clock_gettime(CLOCK_MONOTONIC, &cmd->t_queue); -+ if (cmd->t_first_queue.tv_sec == 0) { - cmd->t_first_queue = cmd->t_queue; - } - #endif -@@ -424,7 +425,7 @@ send_client_notify(gpointer key, gpointer value, gpointer user_data) - client->name, client->id, msg, rc); - } - --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - /*! - * \internal - * \brief Return difference between two times in milliseconds -@@ -432,21 +433,25 @@ send_client_notify(gpointer key, gpointer value, gpointer user_data) - * \param[in] now More recent time (or NULL to use current time) - * \param[in] old Earlier time - * -- * \return milliseconds difference (or 0 if old is NULL or has time zero) -+ * \return milliseconds difference (or 0 if old is NULL or has tv_sec zero) -+ * -+ * \note Can overflow on 32bit machines when the differences is around -+ * 50 days or more. - */ - static int --time_diff_ms(struct timeb *now, struct timeb *old) -+time_diff_ms(struct timespec *now, struct timespec *old) - { -- struct timeb local_now = { 0, }; -+ struct timespec local_now = { 0, }; - - if (now == NULL) { -- ftime(&local_now); -+ clock_gettime(CLOCK_MONOTONIC, &local_now); - now = &local_now; - } -- if ((old == NULL) || (old->time == 0)) { -+ if ((old == NULL) || (old->tv_sec == 0)) { - return 0; - } -- return (now->time - old->time) * 1000 + now->millitm - old->millitm; -+ return (now->tv_sec - old->tv_sec) * 1000 -+ + (now->tv_nsec - old->tv_nsec) / 1000; - } - - /*! -@@ -484,7 +489,7 @@ send_cmd_complete_notify(lrmd_cmd_t * cmd) - int queue_time = 0; - xmlNode *notify = NULL; - --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - exec_time = time_diff_ms(NULL, &cmd->t_run); - queue_time = time_diff_ms(&cmd->t_run, &cmd->t_queue); - #endif -@@ -519,9 +524,9 @@ send_cmd_complete_notify(lrmd_cmd_t * cmd) - crm_xml_add_int(notify, F_LRMD_CALLID, cmd->call_id); - crm_xml_add_int(notify, F_LRMD_RSC_DELETED, cmd->rsc_deleted); - --#ifdef HAVE_SYS_TIMEB_H -- crm_xml_add_ll(notify, F_LRMD_RSC_RUN_TIME, (long long) cmd->t_run.time); -- crm_xml_add_ll(notify, F_LRMD_RSC_RCCHANGE_TIME, (long long) cmd->t_rcchange.time); -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) -+ crm_xml_add_ll(notify, F_LRMD_RSC_RUN_TIME, (long long) cmd->t_run.tv_sec); -+ crm_xml_add_ll(notify, F_LRMD_RSC_RCCHANGE_TIME, (long long) cmd->t_rcchange.tv_sec); - crm_xml_add_int(notify, F_LRMD_RSC_EXEC_TIME, exec_time); - crm_xml_add_int(notify, F_LRMD_RSC_QUEUE_TIME, queue_time); - #endif -@@ -592,7 +597,7 @@ cmd_reset(lrmd_cmd_t * cmd) - { - cmd->lrmd_op_status = 0; - cmd->last_pid = 0; --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - memset(&cmd->t_run, 0, sizeof(cmd->t_run)); - memset(&cmd->t_queue, 0, sizeof(cmd->t_queue)); - #endif -@@ -831,9 +836,9 @@ action_complete(svc_action_t * action) - action->id); - return; - } --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - if (cmd->exec_rc != action->rc) { -- ftime(&cmd->t_rcchange); -+ clock_gettime(CLOCK_MONOTONIC, &cmd->t_rcchange); - } - #endif - -@@ -876,7 +881,7 @@ action_complete(svc_action_t * action) - goagain = true; - - } else { --#ifdef HAVE_SYS_TIMEB_H -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - int time_sum = time_diff_ms(NULL, &cmd->t_first_run); - int timeout_left = cmd->timeout_orig - time_sum; - -@@ -912,13 +917,11 @@ action_complete(svc_action_t * action) - } - #endif - -- /* Wrapping this section in ifdef implies that systemd resources are not -- * fully supported on platforms without sys/timeb.h. Since timeb is -- * obsolete, we should eventually prefer a clock_gettime() implementation -- * (wrapped in its own ifdef) with timeb as a fallback. -- */ -- if(goagain) { --#ifdef HAVE_SYS_TIMEB_H -+ /* Wrapping this section in ifdef implies that systemd resources -+ are not fully supported on platforms without CLOCK_MONOTONIC, -+ which is most likely contradiction, but for completeness... */ -+ if (goagain) { -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) - int time_sum = time_diff_ms(NULL, &cmd->t_first_run); - int timeout_left = cmd->timeout_orig - time_sum; - int delay = cmd->timeout_orig / 10; -@@ -1344,11 +1347,11 @@ lrmd_rsc_execute(lrmd_rsc_t * rsc) - rsc->pending_ops = g_list_remove_link(rsc->pending_ops, first); - g_list_free_1(first); - --#ifdef HAVE_SYS_TIMEB_H -- if (cmd->t_first_run.time == 0) { -- ftime(&cmd->t_first_run); -+#if HAVE_DECL_CLOCK_MONOTONIC && defined(CLOCK_MONOTONIC) -+ if (cmd->t_first_run.tv_sec == 0) { -+ clock_gettime(CLOCK_MONOTONIC, &cmd->t_first_run); - } -- ftime(&cmd->t_run); -+ clock_gettime(CLOCK_MONOTONIC, &cmd->t_run); - #endif - } - --- -2.24.0.rc1 - diff --git a/pacemaker.spec b/pacemaker.spec index 0184617..5c940a4 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -18,7 +18,7 @@ ## Upstream commit (or git tag, such as "Pacemaker-" plus the ## {pcmkversion} macro for an official release) to use for this package -%global commit Pacemaker-2.0.3-rc3 +%global commit Pacemaker-2.0.3 ## Since git v2.11, the extent of abbreviation is autoscaled by default ## (used to be constant of 7), so we need to convey it for non-tags, too. %global commit_abbrev 9 @@ -143,7 +143,7 @@ Url: http://www.clusterlabs.org Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz Source1: https://github.com/%{github_owner}/%{nagios_name}/archive/%{nagios_hash}/%{nagios_name}-%{nagios_hash}.tar.gz # --- -Patch0: Build-restore-buildability-in-the-face-of-obsolete-ftime.patch +# patches go here Requires: resource-agents Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -188,7 +188,7 @@ BuildRequires: asciidoc inkscape publican %endif # git-style patch application -BuildRequires: git +#BuildRequires: git Provides: pcmk-cluster-manager = %{version}-%{release} Provides: pcmk-cluster-manager%{?_isa} = %{version}-%{release} @@ -348,9 +348,9 @@ monitor resources. %prep %setup -q -a 1 -n %{name}-%{commit} -%global __scm git_am -%__scm_setup_git -%autopatch -p1 +#global __scm git_am +#__scm_setup_git +#autopatch -p1 %build @@ -373,6 +373,9 @@ export LDFLAGS_HARDENED_LIB="%{?_hardening_ldflags}" ./autogen.sh +# Rawhide glibc doesn't like ftime at all +export CPPFLAGS="-UPCMK_TIME_EMERGENCY_CGT $CPPFLAGS" + %{configure} \ PYTHON=%{python_path} \ %{!?with_hardening: --disable-hardening} \ @@ -710,6 +713,13 @@ exit 0 %license %{nagios_name}-%{nagios_hash}/COPYING %changelog +* Tue Nov 26 2019 Jan Pokorný - 2.0.3-1 +- Update for new upstream tarball: Pacemaker-2.0.3, + for full details, see included ChangeLog file or + https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-2.0.3 + (functionally identical to 2.0.3-rc3, new build mostly to fix a memory + leak & allow for easy glibc ~2.31+ friendly switch away from ftime(3)) + * Thu Nov 14 2019 Jan Pokorný - 2.0.3-0.1.rc3 - Update for new upstream tarball for release candidate: Pacemaker-2.0.3-rc3, for full details, see included ChangeLog file or diff --git a/sources b/sources index 6e3ead3..dfdffcc 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (pacemaker-2.0.3-rc3.tar.gz) = c191e2c8ff9984086aa5c8b168cd27f1340b65551885998c30e4b1c14e41973779ffd35c648bfd626b34aa04c25d34d0cd6a26f0c4931e1daee1992907ed0a97 +SHA512 (pacemaker-2.0.3.tar.gz) = 957af652c07019cdd1bffaf6c5550de0dc6148c9cb2ef485e091c40bed8f60be86c0950917903d2b44c251a87f170258d0c79a2cf2d989cc1a47ddd5c79be9c2 SHA512 (nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz) = 11ddeb48a4929e7642b6dfa9c7962aa1d7a1af1c569830f55ed6cd6773abac13377317327bc1db8411c8077884f83f81cc54d746c834b63a99fa6dc219b5caad