]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
util-linux: fix ptest failure for musl
authorChen Qi <Qi.Chen@windriver.com>
Thu, 5 Jun 2025 03:42:10 +0000 (11:42 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 12 Jun 2025 10:02:56 +0000 (11:02 +0100)
The kill/decode test case fails for musl. The root cause is the test
case only considers glibc and uses 34 as SIGRTMIN while musl uses 35.
Add patches to fix this issue.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/util-linux/util-linux.inc
meta/recipes-core/util-linux/util-linux/0001-test_sysinfo.c-print-out-SIGRTMIN.patch [new file with mode: 0644]
meta/recipes-core/util-linux/util-linux/0002-ts-kill-decode-use-SIGRTMIN-from-test_sysinfo-instea.patch [new file with mode: 0644]

index b0f2a9d49771fc5493c28efa894685f5355b5350..fc5add37aca97ba71120cda41c95313edcb75c51 100644 (file)
@@ -42,6 +42,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
            file://fcntl-lock.c \
            file://0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch \
            file://0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch \
+           file://0001-test_sysinfo.c-print-out-SIGRTMIN.patch \
+           file://0002-ts-kill-decode-use-SIGRTMIN-from-test_sysinfo-instea.patch \
            "
 
 SRC_URI[sha256sum] = "81ee93b3cfdfeb7d7c4090cedeba1d7bbce9141fd0b501b686b3fe475ddca4c6"
diff --git a/meta/recipes-core/util-linux/util-linux/0001-test_sysinfo.c-print-out-SIGRTMIN.patch b/meta/recipes-core/util-linux/util-linux/0001-test_sysinfo.c-print-out-SIGRTMIN.patch
new file mode 100644 (file)
index 0000000..ee9f220
--- /dev/null
@@ -0,0 +1,50 @@
+From 50774e34fee0cd528b195a863bcd4e3a04fbfc4b Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 4 Jun 2025 10:52:18 +0800
+Subject: [PATCH 1/2] test_sysinfo.c: print out SIGRTMIN
+
+This will be used by ts/kill/decode.
+
+Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/3605]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ tests/helpers/test_sysinfo.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c
+index 1559d471f..3a791e7f1 100644
+--- a/tests/helpers/test_sysinfo.c
++++ b/tests/helpers/test_sysinfo.c
+@@ -27,6 +27,7 @@
+ #include <errno.h>
+ #include <time.h>
+ #include <sys/ioctl.h>
++#include <signal.h>
+ #include "c.h"
+@@ -116,6 +117,12 @@ static int hlp_ulong_max32(void)
+       return 0;
+ }
++static int hlp_sigrtmin(void)
++{
++      printf("%d\n", SIGRTMIN);
++      return 0;
++}
++
+ static int hlp_wcsspn_ok(void)
+ {
+       printf("%d\n", wcsspn(L"FOO", L"F") == 1);
+@@ -229,6 +236,7 @@ static const mntHlpfnc hlps[] =
+       { "ULONG_MAX",  hlp_ulong_max   },
+       { "ULONG_MAX32",hlp_ulong_max32 },
+       { "UINT64_MAX", hlp_u64_max     },
++      { "SIGRTMIN",   hlp_sigrtmin    },
+       { "byte-order", hlp_endianness  },
+       { "wcsspn-ok",  hlp_wcsspn_ok   },
+       { "enotty-ok",  hlp_enotty_ok   },
+-- 
+2.34.1
+
diff --git a/meta/recipes-core/util-linux/util-linux/0002-ts-kill-decode-use-SIGRTMIN-from-test_sysinfo-instea.patch b/meta/recipes-core/util-linux/util-linux/0002-ts-kill-decode-use-SIGRTMIN-from-test_sysinfo-instea.patch
new file mode 100644 (file)
index 0000000..5a00c90
--- /dev/null
@@ -0,0 +1,56 @@
+From 9848b0d8c90d9a24275bf402f6d76e97f62b3ba4 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 4 Jun 2025 16:27:19 +0800
+Subject: [PATCH 2/2] ts/kill/decode: use SIGRTMIN from test_sysinfo instead of
+ hardcoding 34
+
+glibc uses 34 as the value of SIGRTMIN:
+https://sourceware.org/git/?p=glibc.git;a=blob;f=signal/allocrtsig.c;h=8ed8e37dd6c41f94be6eef042ce9db1af1153228;hb=HEAD#l27 """
+static int current_rtmin = __SIGRTMIN + RESERVED_SIGRT; """
+
+musl uses 35 as the value of SIGRTMIN:
+https://git.musl-libc.org/cgit/musl/tree/src/signal/sigrtmin.c
+
+With the hardcoded 34, test case fails with the following difference:
+
+-Ignored: HUP QUIT TRAP PIPE ALRM
++Ignored: HUP QUIT TRAP PIPE ALRM 34
+
+Use SIGRTMIN got from test_sysinfo to fix this issue.
+
+Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/3605]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ tests/ts/kill/decode | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/tests/ts/kill/decode b/tests/ts/kill/decode
+index 03bc25ff6..dd34aacef 100755
+--- a/tests/ts/kill/decode
++++ b/tests/ts/kill/decode
+@@ -48,14 +48,19 @@ ACK=
+           # Sending one more USR1 is for making the signal pending state.
+           "$TS_CMD_KILL" -USR1 "$PID"
+           "$TS_CMD_KILL" -d "$PID" | {
+-              if [[ $("$TS_CMD_KILL" --list=34) == RT0 ]]; then
++              SIGRTMIN=$($TS_HELPER_SYSINFO SIGRTMIN)
++              if [[ $("$TS_CMD_KILL" --list=$SIGRTMIN) == RT0 ]]; then
+                   # See man signal(7).
+                   #   The  Linux  kernel  supports a range of 33 different real-time signals,
+                   #   numbered 32 to 64.  However, the glibc POSIX threads implementation in‐
+                   #   ternally uses two (for NPTL) or three (for LinuxThreads) real-time sig‐
+                   #   nals (see pthreads(7)), and adjusts the value of SIGRTMIN suitably  (to
+                   #   34 or 35).
+-                  sed -e s/' 32 33'// -e s/' 34'//
++                  sed_cmd="sed"
++                  for ((i=32; i<=SIGRTMIN; i++)); do
++                      sed_cmd+=" -e s/' $i'//"
++                  done
++                  eval $sed_cmd
+               else
+                   cat
+               fi
+-- 
+2.34.1
+