Compare commits

..

No commits in common. "c5d29cff2e311a4d9ee4eabb5a95f33e301fac18" and "9d9a771e5cc8d767d8b6a65457b0fb189da40c0d" have entirely different histories.

10 changed files with 271 additions and 228 deletions

View File

@ -0,0 +1,41 @@
From 956f3558d4b619fb19eaa040614dfaf9a226d514 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Mon, 28 Jun 2021 17:37:44 +0200
Subject: [PATCH] Build: Fix: correctly derive package version from git
---
Makefile.am | 4 ++--
sbd.spec | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e614754..5d53c4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,8 +73,8 @@ spec:
sed -i 's/global\ build_counter.*/global\ build_counter\ $(COUNT)/' $(distdir)/$(PACKAGE).spec; \
echo $(COUNT) > $(BUILD_COUNTER); \
fi
- if [ -n $(COMMIT_COUNTER) ]; then \
- sed -i 's/global\ commit_counter.*/global\ commit_counter\ $(COMMIT_COUNTER)-1/' $(distdir)/$(PACKAGE).spec; \
+ if [ -n "$(COMMIT_COUNTER)" ]; then \
+ sed -i 's/global\ commit_counter.*/global\ commit_counter\ $(COMMIT_COUNTER)/' $(distdir)/$(PACKAGE).spec; \
fi
srpm: export spec
diff --git a/sbd.spec b/sbd.spec
index 776e48b..0498db1 100644
--- a/sbd.spec
+++ b/sbd.spec
@@ -20,7 +20,7 @@
%global modified %(echo %{longcommit}-|cut -f2 -d-)
%global github_owner Clusterlabs
%global commit_counter 0
-%global build_counter 1
+%global build_counter 0
%global buildnum %(expr %{commit_counter} + %{build_counter})
%ifarch s390x s390
--
1.8.3.1

View File

@ -1,84 +0,0 @@
From 030d7edb179235b7df65ada3a79837b01e682a5b Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Thu, 21 Jul 2022 10:48:21 +0200
Subject: [PATCH] Fix: query-watchdog: avoid issues on heap allocation failing
coverity is moaning either due to slight code rearangement
or new version/settings.
---
src/sbd-common.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/sbd-common.c b/src/sbd-common.c
index f3f226a..3abf75f 100644
--- a/src/sbd-common.c
+++ b/src/sbd-common.c
@@ -385,8 +385,17 @@ watchdog_populate_list(void)
struct link_list_item *lli =
calloc(1, sizeof(struct link_list_item));
+ if (lli == NULL) {
+ break;
+ }
lli->dev_node = strdup(buf);
lli->link_name = strdup(entry_name);
+ if ((lli->dev_node == NULL) || (lli->link_name == NULL)) {
+ free(lli->dev_node);
+ free(lli->link_name);
+ free(lli);
+ break;
+ }
lli->next = link_list;
link_list = lli;
}
@@ -404,18 +413,27 @@ watchdog_populate_list(void)
if(!stat(entry_name, &statbuf) && S_ISCHR(statbuf.st_mode) &&
is_watchdog(statbuf.st_rdev)) {
- int wdfd = watchdog_init_fd(entry_name, -1);
+ int wdfd;
struct watchdog_list_item *wdg =
calloc(1, sizeof(struct watchdog_list_item));
int len;
struct link_list_item *tmp_list = NULL;
+ if (wdg == NULL) {
+ break;
+ }
+
wdg->dev = statbuf.st_rdev;
wdg->dev_node = strdup(entry_name);
+ if (wdg->dev_node == NULL) {
+ free(wdg);
+ break;
+ }
wdg->next = watchdog_list;
watchdog_list = wdg;
watchdog_list_items++;
+ wdfd = watchdog_init_fd(entry_name, -1);
if (wdfd >= 0) {
struct watchdog_info ident;
@@ -450,11 +468,18 @@ watchdog_populate_list(void)
struct watchdog_list_item *dupe_wdg =
calloc(1, sizeof(struct watchdog_list_item));
+ if (dupe_wdg == NULL) {
+ break;
+ }
/* as long as we never purge watchdog_list
* there is no need to dupe strings
*/
*dupe_wdg = *wdg;
dupe_wdg->dev_node = strdup(tmp_list->link_name);
+ if (dupe_wdg->dev_node == NULL) {
+ free(dupe_wdg);
+ break;
+ }
dupe_wdg->next = watchdog_list;
watchdog_list = dupe_wdg;
watchdog_list_items++;
--
2.39.0

View File

@ -0,0 +1,43 @@
From 8438c244cc2066fbe9c598a6392e8935cf017d97 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 25 Jun 2021 15:02:14 +0200
Subject: [PATCH] Refactor: sbd-inquisitor: functionize striping leading spaces
of an option value
---
src/sbd-inquisitor.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
index 4fec2fd..53ddfa3 100644
--- a/src/sbd-inquisitor.c
+++ b/src/sbd-inquisitor.c
@@ -40,9 +40,8 @@ bool sync_resource_startup = false;
int parse_device_line(const char *line);
static const char *
-get_env_option(const char *option)
+sanitize_option_value(const char *value)
{
- const char *value = getenv(option);
size_t max = 0;
size_t lpc = 0;
@@ -61,6 +60,14 @@ get_env_option(const char *option)
return (strlen(value + lpc) > 0 ? (value + lpc) : NULL);
}
+static const char *
+get_env_option(const char *option)
+{
+ const char *value = getenv(option);
+
+ return sanitize_option_value(value);
+}
+
static int
recruit_servant(const char *devname, pid_t pid)
{
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From 48c9a11e5b4ace22011e51d4c5dcacaddf9bbc43 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Fri, 3 Feb 2023 10:58:10 +0100
Subject: [PATCH] Refactor: sbd-md: alloc/de-alloc reverse order
Having de-allocation in the reverse order compared to
allocation seems to make gcc-12 static analysis of
dynamic-memory-management happy.
---
src/sbd-md.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/sbd-md.c b/src/sbd-md.c
index 7a37522..2a237ad 100644
--- a/src/sbd-md.c
+++ b/src/sbd-md.c
@@ -441,9 +441,9 @@ init_device(struct sbd_context *st)
}
}
-out: free(s_node);
+out: free(s_mbox);
+ free(s_node);
free(s_header);
- free(s_mbox);
return(rc);
}
@@ -556,9 +556,9 @@ slot_allocate(struct sbd_context *st, const char *name)
}
}
-out: free(s_node);
+out: free(s_mbox);
+ free(s_node);
free(s_header);
- free(s_mbox);
return(rc);
}
@@ -1279,11 +1279,10 @@ int servant_md(const char *diskname, int mode, const void* argp)
}
}
out:
- free(s_header);
free(s_node);
free(s_mbox);
+ free(s_header);
close_device(st);
exit(rc);
}
-
--
2.39.0

View File

@ -0,0 +1,29 @@
From c1bb2a4d8c8ec66c72da3ec080f23b1f858a66af Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Mon, 28 Jun 2021 13:35:56 +0200
Subject: [PATCH] Log: sbd-inquisitor: tell the actual watchdog device
specified with `-w`
---
src/sbd-inquisitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
index 53ddfa3..2cf09ac 100644
--- a/src/sbd-inquisitor.c
+++ b/src/sbd-inquisitor.c
@@ -1042,10 +1042,10 @@ int main(int argc, char **argv, char **envp)
W_count++;
break;
case 'w':
- cl_log(LOG_NOTICE, "Using watchdog device '%s'", watchdogdev);
free(watchdogdev);
watchdogdev = strdup(optarg);
watchdogdev_is_default = false;
+ cl_log(LOG_NOTICE, "Using watchdog device '%s'", watchdogdev);
break;
case 'd':
#if SUPPORT_SHARED_DISK
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From 0e4534ebdfe8d7a37beb0028e604e560a5674891 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Fri, 3 Feb 2023 15:35:22 +0100
Subject: [PATCH] spec: convert license naming to SPDX
---
sbd.spec | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sbd.spec b/sbd.spec
index e9ff7bc..b9e7f72 100644
--- a/sbd.spec
+++ b/sbd.spec
@@ -49,7 +49,7 @@
Name: sbd
Summary: Storage-based death
-License: GPLv2+
+License: GPL-2.0-or-later
Group: System Environment/Daemons
Version: 1.5.2
Release: 99.%{buildnum}.%{shortcommit}.%{modified}git%{?dist}
@@ -95,7 +95,7 @@ Available rpmbuild rebuild options:
%package tests
Summary: Storage-based death environment for regression tests
-License: GPLv2+
+License: GPL-2.0-or-later
Group: System Environment/Daemons
%description tests
--
2.39.0

View File

@ -0,0 +1,146 @@
From 1c72cf23561deeb69b04891f3fc4d0613f73fbb0 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 25 Jun 2021 15:21:38 +0200
Subject: [PATCH] Fix: sbd-inquisitor: tolerate and strip any leading spaces of
command line option values
Somehow an user's own monitoring agent doesn't well parse an SBD_DEVICE
setting with spaces between the device names:
SBD_DEVICE="/dev/<a>; /dev/<b>; /dev/<c>"
And eventually it calls an sbd command:
`sbd list -d " /dev/<b>"`
-- A space is prefixed to the device name which is quoted.
Of course it could be easily fixed in the setting or their agent. But
OTOH, sbd'd better tolerate and strip any leading spaces of command line
option values.
---
src/sbd-inquisitor.c | 41 +++++++++++++++++++++++++----------------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
index 2cf09ac..944a353 100644
--- a/src/sbd-inquisitor.c
+++ b/src/sbd-inquisitor.c
@@ -999,6 +999,15 @@ int main(int argc, char **argv, char **envp)
}
while ((c = getopt(argc, argv, "czC:DPRTWZhvw:d:n:p:1:2:3:4:5:t:I:F:S:s:r:")) != -1) {
+ /* Call it before checking optarg for NULL to make coverity happy */
+ const char *sanitized_optarg = sanitize_option_value(optarg);
+
+ if (optarg && sanitized_optarg == NULL) {
+ fprintf(stderr, "Invalid value \"%s\" for option -%c\n", optarg, c);
+ exit_status = -2;
+ goto out;
+ }
+
switch (c) {
case 'D':
break;
@@ -1011,11 +1020,11 @@ int main(int argc, char **argv, char **envp)
cl_log(LOG_INFO, "Realtime mode deactivated.");
break;
case 'S':
- start_mode = atoi(optarg);
+ start_mode = atoi(sanitized_optarg);
cl_log(LOG_INFO, "Start mode set to: %d", (int)start_mode);
break;
case 's':
- timeout_startup = atoi(optarg);
+ timeout_startup = atoi(sanitized_optarg);
cl_log(LOG_INFO, "Start timeout set to: %d", (int)timeout_startup);
break;
case 'v':
@@ -1043,13 +1052,13 @@ int main(int argc, char **argv, char **envp)
break;
case 'w':
free(watchdogdev);
- watchdogdev = strdup(optarg);
+ watchdogdev = strdup(sanitized_optarg);
watchdogdev_is_default = false;
cl_log(LOG_NOTICE, "Using watchdog device '%s'", watchdogdev);
break;
case 'd':
#if SUPPORT_SHARED_DISK
- if (recruit_servant(optarg, 0) != 0) {
+ if (recruit_servant(sanitized_optarg, 0) != 0) {
fprintf(stderr, "Invalid device: %s\n", optarg);
exit_status = -1;
goto out;
@@ -1070,48 +1079,48 @@ int main(int argc, char **argv, char **envp)
disk_priority = 0;
break;
case 'n':
- local_uname = strdup(optarg);
+ local_uname = strdup(sanitized_optarg);
cl_log(LOG_INFO, "Overriding local hostname to %s", local_uname);
break;
case 'p':
- pidfile = strdup(optarg);
+ pidfile = strdup(sanitized_optarg);
cl_log(LOG_INFO, "pidfile set to %s", pidfile);
break;
case 'C':
- timeout_watchdog_crashdump = atoi(optarg);
+ timeout_watchdog_crashdump = atoi(sanitized_optarg);
cl_log(LOG_INFO, "Setting crashdump watchdog timeout to %d",
(int)timeout_watchdog_crashdump);
break;
case '1':
- timeout_watchdog = atoi(optarg);
+ timeout_watchdog = atoi(sanitized_optarg);
break;
case '2':
- timeout_allocate = atoi(optarg);
+ timeout_allocate = atoi(sanitized_optarg);
break;
case '3':
- timeout_loop = atoi(optarg);
+ timeout_loop = atoi(sanitized_optarg);
break;
case '4':
- timeout_msgwait = atoi(optarg);
+ timeout_msgwait = atoi(sanitized_optarg);
break;
case '5':
- timeout_watchdog_warn = atoi(optarg);
+ timeout_watchdog_warn = atoi(sanitized_optarg);
do_calculate_timeout_watchdog_warn = false;
cl_log(LOG_INFO, "Setting latency warning to %d",
(int)timeout_watchdog_warn);
break;
case 't':
- servant_restart_interval = atoi(optarg);
+ servant_restart_interval = atoi(sanitized_optarg);
cl_log(LOG_INFO, "Setting servant restart interval to %d",
(int)servant_restart_interval);
break;
case 'I':
- timeout_io = atoi(optarg);
+ timeout_io = atoi(sanitized_optarg);
cl_log(LOG_INFO, "Setting IO timeout to %d",
(int)timeout_io);
break;
case 'F':
- servant_restart_count = atoi(optarg);
+ servant_restart_count = atoi(sanitized_optarg);
cl_log(LOG_INFO, "Servant restart count set to %d",
(int)servant_restart_count);
break;
@@ -1119,7 +1128,7 @@ int main(int argc, char **argv, char **envp)
if (timeout_action) {
free(timeout_action);
}
- timeout_action = strdup(optarg);
+ timeout_action = strdup(sanitized_optarg);
break;
case 'h':
usage();
--
1.8.3.1

View File

@ -5,7 +5,6 @@ decision_context: bodhi_update_push_testing
subject_type: koji_build subject_type: koji_build
rules: rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy --- !Policy
product_versions: product_versions:
- fedora-* - fedora-*
@ -13,10 +12,3 @@ decision_context: bodhi_update_push_stable
subject_type: koji_build subject_type: koji_build
rules: rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -15,7 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
%global longcommit cf5c2208bad2db2dff9b09624b89b05415c3bc11 %global longcommit d7f447d689da52897e190114c448d1129f3c5f72
%global shortcommit %(echo %{longcommit}|cut -c1-8) %global shortcommit %(echo %{longcommit}|cut -c1-8)
%global modified %(echo %{longcommit}-|cut -f2 -d-) %global modified %(echo %{longcommit}-|cut -f2 -d-)
%global github_owner Clusterlabs %global github_owner Clusterlabs
@ -47,14 +47,15 @@
Name: sbd Name: sbd
Summary: Storage-based death Summary: Storage-based death
License: GPL-2.0-or-later License: GPLv2+
Version: 1.5.2 Version: 1.5.0
Release: %{buildnum}%{?dist}.2 Release: %{buildnum}%{?dist}
Url: https://github.com/%{github_owner}/%{name} Url: https://github.com/%{github_owner}/%{name}
Source0: https://github.com/%{github_owner}/%{name}/archive/%{longcommit}/%{name}-%{longcommit}.tar.gz Source0: https://github.com/%{github_owner}/%{name}/archive/%{longcommit}/%{name}-%{longcommit}.tar.gz
Patch0: 0001-Fix-query-watchdog-avoid-issues-on-heap-allocation-f.patch Patch0: 0001-Build-Fix-correctly-derive-package-version-from-git.patch
Patch1: 0002-Refactor-sbd-md-alloc-de-alloc-reverse-order.patch Patch1: 0002-Refactor-sbd-inquisitor-functionize-striping-leading.patch
Patch2: 0003-spec-convert-license-naming-to-SPDX.patch Patch2: 0003-Log-sbd-inquisitor-tell-the-actual-watchdog-device-s.patch
Patch3: 0004-Fix-sbd-inquisitor-tolerate-and-strip-any-leading-sp.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
@ -88,7 +89,7 @@ Available rpmbuild rebuild options:
%package tests %package tests
Summary: Storage-based death environment for regression tests Summary: Storage-based death environment for regression tests
License: GPL-2.0-or-later License: GPLv2+
%description tests %description tests
This package provides an environment + testscripts for This package provides an environment + testscripts for
@ -106,8 +107,7 @@ regression-testing sbd.
export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror" export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror"
%configure --with-watchdog-timeout-default=%{watchdog_timeout_default} \ %configure --with-watchdog-timeout-default=%{watchdog_timeout_default} \
--with-sync-resource-startup-default=%{?with_sync_resource_startup_default:yes}%{!?with_sync_resource_startup_default:no} \ --with-sync-resource-startup-default=%{?with_sync_resource_startup_default:yes}%{!?with_sync_resource_startup_default:no} \
--with-sync-resource-startup-sysconfig=%{sync_resource_startup_sysconfig} \ --with-sync-resource-startup-sysconfig=%{sync_resource_startup_sysconfig}
--with-runstatedir=%{_rundir}
make %{?_smp_mflags} make %{?_smp_mflags}
########################################################### ###########################################################
@ -179,40 +179,6 @@ fi
%{_libdir}/libsbdtestbed* %{_libdir}/libsbdtestbed*
%changelog %changelog
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-1.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Feb 3 2023 Klaus Wenninger <kwenning@redhat.com> - 1.5.2-1
- rebase to upstream v1.5.2
- convert license naming to SPDX
- make static analysis happy with a few checks & rearanges with
dynamic-memory-management
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-2.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jan 31 2022 Klaus Wenninger <kwenning@redhat.com> - 1.5.1-2
- Having de-allocation in the reverse order compared to
allocation seems to make gcc-12 static analysis of
dynamic-memory-management happy.
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Nov 19 2021 Klaus Wenninger <kwenning@redhat.com> - 1.5.1-1
- sync with upstream spec-file
- Rebase to upstream v1.5.1
- added policy for rhel to gating
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jul 6 2021 Klaus Wenninger <kwenning@redhat.com> - 1.5.0-1 * Tue Jul 6 2021 Klaus Wenninger <kwenning@redhat.com> - 1.5.0-1
- sync with upstream spec-file - sync with upstream spec-file
- Rebase to upstream v1.5.0 - Rebase to upstream v1.5.0

View File

@ -1 +1 @@
SHA512 (sbd-cf5c2208bad2db2dff9b09624b89b05415c3bc11.tar.gz) = e67a229ea77a9cedcbe73ee2bc3db51b35d7254ea9e402cfbcd4ce12da757c8f4d0afd8596b5c888453615b81ecc6f83d3e968a62bdd652f1c37df698f2808c7 SHA512 (sbd-d7f447d689da52897e190114c448d1129f3c5f72.tar.gz) = 45a8d6f5b9a03f0c310ed0472baddbd5fb59e1d928611078da938c11d5e6ff43520dd8f7b17e1c2fee86a73c4c6e744782e1d09ac8563db4858e6293fb783afe