From e141a2963999a6ad8aee03622f53b3c549f7dbb2 Mon Sep 17 00:00:00 2001 From: Weisson Date: Tue, 17 Oct 2023 17:29:36 +0800 Subject: [PATCH] Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN is defined as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. sysconf() returns a long and can, at least in theory, return -1. This change causes compilation to fail in setup_thread_attr() due to a comparision with different signedness, since stacksize is a size_t. Signed-off-by: Weisson --- ...c-2.34-commit-5d98a7da-PTHREAD_STACK.patch | 34 +++++++++++++++++++ device-mapper-multipath.spec | 6 +++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 2000-Starting-in-glibc-2.34-commit-5d98a7da-PTHREAD_STACK.patch diff --git a/2000-Starting-in-glibc-2.34-commit-5d98a7da-PTHREAD_STACK.patch b/2000-Starting-in-glibc-2.34-commit-5d98a7da-PTHREAD_STACK.patch new file mode 100644 index 0000000..c91fb23 --- /dev/null +++ b/2000-Starting-in-glibc-2.34-commit-5d98a7da-PTHREAD_STACK.patch @@ -0,0 +1,34 @@ +From 0fbe82aec2f920930d8ccbf697b125ccc922631c Mon Sep 17 00:00:00 2001 +From: Weisson +Date: Tue, 17 Oct 2023 17:08:08 +0800 +Subject: [PATCH] Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN + is defined as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. + sysconf() returns a long and can, at least in theory, return -1. This change + causes compilation to fail in setup_thread_attr() due to a comparision with + different signedness, since stacksize is a size_t. + +from upstream: #5d9f01cb6650c5024bf6c70ade7936e9c71ed9b9 + +Signed-off-by: Weisson +--- + libmultipath/util.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libmultipath/util.c b/libmultipath/util.c +index e04d20a..7a5a09b 100644 +--- a/libmultipath/util.c ++++ b/libmultipath/util.c +@@ -279,8 +279,8 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached) + + ret = pthread_attr_init(attr); + assert(ret == 0); +- if (stacksize < PTHREAD_STACK_MIN) +- stacksize = PTHREAD_STACK_MIN; ++ if (PTHREAD_STACK_MIN > 0 && stacksize < (size_t)PTHREAD_STACK_MIN) ++ stacksize = (size_t)PTHREAD_STACK_MIN; + ret = pthread_attr_setstacksize(attr, stacksize); + assert(ret == 0); + if (detached) { +-- +2.31.1 + diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec index 96818eb..48ef7a5 100644 --- a/device-mapper-multipath.spec +++ b/device-mapper-multipath.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 Summary: Tools to manage multipath devices using device-mapper Name: device-mapper-multipath Version: 0.8.4 @@ -145,6 +145,7 @@ Patch00130: 0130-libmultipath-cleanup-ACT_CREATE-code-in-select_actio.patch Patch00131: 0131-libmultipath-keep-renames-from-stopping-other-multip.patch Patch01000: 0001-modify-OPTFLAGS-for-loongarch64.patch +Patch02000: 2000-Starting-in-glibc-2.34-commit-5d98a7da-PTHREAD_STACK.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -349,6 +350,9 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog +* Tue Oct 17 2023 Weisson 0.8.4-37.0.2 +- fix the problem comparison of integer expressions of different signedness. + * Fri May 26 2023 zhangwenlong 0.8.4-37.0.1 - Add loongarch64 support for device-mapper-multipath -- Gitee