]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
util-linux: correct test case kill/decode for bash 5.3
authorHongxu Jia <hongxu.jia@windriver.com>
Mon, 28 Jul 2025 13:42:38 +0000 (21:42 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 31 Jul 2025 09:47:57 +0000 (10:47 +0100)
After upgrading bash to 5.3 to contain commit [1], if SIGINT was trapped in
asynchronous subshell, bash called set_signal_async_ignored to make sure
processes that are created by this asynchronous subshell to ignore SIGINT.

And it caused test case `kill/decode' failed, the signal INT was existed in
both of Blocked and Ignored

root@qemux86-64:~# cd /usr/lib/util-linux/ptest/
root@qemux86-64:/usr/lib/util-linux/ptest# ./run-ptest
...
diff-{{{
|--- /usr/lib/util-linux/ptest/tests/expected/kill/decode        2011-04-05 23:00:00.000000000 +0000
|+++ /usr/lib/util-linux/ptest/tests/output/kill/decode  2025-07-28 12:09:46.279000000 +0000
@@ -16,5 +16,5 @@
 Pending (thread): INT ILL
 Pending (process): USR1
 Blocked: INT ILL ABRT FPE USR1 SEGV TERM
-Ignored: HUP QUIT TRAP PIPE ALRM
+Ignored: HUP INT QUIT TRAP PIPE ALRM
 Caught: ILL USR1
}}}-diff
...

Explicitly reset SIGINT to default action after trapping, then the
test case `kill/decode' works on both of old (<5.3) and new (>=5.3) bash

[1] https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=a5d2617c7a7e602ace1f4149987cdfd075c4e762

Signed-off-by: Hongxu Jia <hongxu.jia@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-tests-helpers-test_sigstate.c-explicitly-reset-SIGIN.patch [new file with mode: 0644]

index 111f29cb928723a8741918f11cf9e84e687325da..7d6759a2c0e853ad5d3e8efea14b4239562db024 100644 (file)
@@ -20,6 +20,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
            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-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch \
+           file://0001-tests-helpers-test_sigstate.c-explicitly-reset-SIGIN.patch \
            "
 
 SRC_URI[sha256sum] = "81ee93b3cfdfeb7d7c4090cedeba1d7bbce9141fd0b501b686b3fe475ddca4c6"
diff --git a/meta/recipes-core/util-linux/util-linux/0001-tests-helpers-test_sigstate.c-explicitly-reset-SIGIN.patch b/meta/recipes-core/util-linux/util-linux/0001-tests-helpers-test_sigstate.c-explicitly-reset-SIGIN.patch
new file mode 100644 (file)
index 0000000..324798c
--- /dev/null
@@ -0,0 +1,55 @@
+From 383efe26a2a61b420d369cd2c23f03d1d690d425 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 28 Jul 2025 20:35:13 +0800
+Subject: [PATCH] tests/helpers/test_sigstate.c: explicitly reset SIGINT to
+ default action after trapping
+
+After upgrading bash to 5.3 to contain commit [1], if SIGINT was trapped in
+asynchronous subshell, bash called set_signal_async_ignored to make sure
+processes that are created by this asynchronous subshell to ignore SIGINT.
+
+And it caused test case `kill/decode' failed, the signal INT was existed in
+both of Blocked and Ignored
+
+$ ./tests/run.sh --use-system-commands --parsable --show-diff   kill/decode
+...
+diff-{{{
+|--- /usr/lib/util-linux/ptest/tests/expected/kill/decode        2011-04-05 23:00:00.000000000 +0000
+|+++ /usr/lib/util-linux/ptest/tests/output/kill/decode  2025-07-28 12:09:46.279000000 +0000
+@@ -16,5 +16,5 @@
+ Pending (thread): INT ILL
+ Pending (process): USR1
+ Blocked: INT ILL ABRT FPE USR1 SEGV TERM
+-Ignored: HUP QUIT TRAP PIPE ALRM
++Ignored: HUP INT QUIT TRAP PIPE ALRM
+ Caught: ILL USR1
+}}}-diff
+...
+
+Explicitly reset SIGINT to default action after trapping, then the
+test case `kill/decode' works on both of old (<5.3) and new (>=5.3) bash
+
+[1] https://cgit.git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=a5d2617c7a7e602ace1f4149987cdfd075c4e762
+
+Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/3666]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ tests/helpers/test_sigstate.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tests/helpers/test_sigstate.c b/tests/helpers/test_sigstate.c
+index 52c7dcb..b631ec2 100644
+--- a/tests/helpers/test_sigstate.c
++++ b/tests/helpers/test_sigstate.c
+@@ -68,6 +68,7 @@ int main(int argc _U_, char **argv _U_)
+       sigignore(SIGPIPE);
+       sigignore(SIGALRM);
++      signal(SIGINT, SIG_DFL);
+       signal(SIGBUS, SIG_DFL);
+       signal(SIGFPE, SIG_DFL);
+       signal(SIGSEGV, SIG_DFL);
+-- 
+2.34.1
+