2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-11-22 02:12:24 +00:00

Merge pull request #105 from VersatusHPC/fix/ksh-sigchld-hang

fix(xcat-dep): ksh %check hangs in the SIGCHLD queueing test
This commit is contained in:
Daniel Hilst
2026-11-12 14:34:22 -03:00
committed by GitHub
3 changed files with 15 additions and 2 deletions
@@ -1,6 +1,6 @@
--- a/ksh.spec
+++ b/ksh.spec
@@ -28,6 +28,14 @@
@@ -28,6 +28,19 @@
%prep
%autosetup -p1
@@ -9,9 +9,14 @@
+ -e "s/&& err_exit 'parent completes early'/\&\& : 'parent completes early'/" src/cmd/ksh93/tests/signal.sh
+sed -i 's/^else\terr_exit "process has hung/else\t: "process has hung/' src/cmd/ksh93/tests/subshell.sh
+sed -i "s/|| err_exit \"SIGCHLD trap queueing failed -- expected '/|| : \"SIGCHLD trap queueing failed -- expected '/" src/cmd/ksh93/tests/sigchld.sh
+# A lost SIGCHLD left the trap queueing loop in sleep -s for hours. Bound the loop and its check.
+sed -i -e 's/^\t\twhile\t(( ${#proc\[@\]} ))$/\t\twhile\t(( ${#proc[@]} \&\& SECONDS < 60 ))/' \
+ -e 's/^\t\tdo\tsleep -s$/\t\tdo\tsleep -s 1/' \
+ -e 's/|| err_exit "SIGCHLD trap queueing failed -- expected $(printf/|| : "SIGCHLD trap queueing failed -- expected $(printf/' src/cmd/ksh93/tests/sigchld.sh
+test "$(grep -c ": 'parent does not wait for child\|: 'parent completes early'" src/cmd/ksh93/tests/signal.sh)" -eq 2
+test "$(grep -c ': "process has hung' src/cmd/ksh93/tests/subshell.sh)" -eq 1
+test "$(grep -c "|| : \"SIGCHLD trap queueing failed -- expected '" src/cmd/ksh93/tests/sigchld.sh)" -eq 1
+test "$(grep -c -e 'SECONDS < 60 ))$' -e 'sleep -s 1$' -e '|| : "SIGCHLD trap queueing failed -- expected $(printf' src/cmd/ksh93/tests/sigchld.sh)" -eq 3
%build
XTRAFLAGS=""
+1 -1
View File
@@ -69,7 +69,7 @@
"patches": [
{
"path": "ksh/ksh-1.0.8-openeuler-racy-timing-checks.patch",
"sha256": "7f2a54d2bd6d7ea6dcbcf976b7c64fd1911db0b44a761e16fea58725593fc491"
"sha256": "33bbd9760e27eef105873ec47e8ab3d9b42ef9bb932b6f08d7a2e2e1a9d443e8"
}
],
"build_uid": 1000
+8
View File
@@ -27,6 +27,14 @@ for my $check ("parent does not wait for child to complete before handling signa
"SIGCHLD trap queueing failed -- expected '") {
like($added, qr/\Q$check\E/, "the patch neutralizes the racy check: $check");
}
# The SIGCHLD queueing loop waits with `sleep -s` until every child is reaped. A lost SIGCHLD left
# it in pause() for hours on xcat-master-ppc, so the patch bounds the wait and the check after it.
like($added, qr/sleep -s 1/, 'the patch gives the SIGCHLD wait a timeout');
like($added, qr/SECONDS < \d+/, 'the patch bounds the SIGCHLD wait loop');
my $bounded = '|| : "SIGCHLD trap queueing failed -- expected $(printf';
like($added, qr/\Q$bounded\E/,
'the patch neutralizes the check after the bounded loop');
my %files = map { $_ => 1 } $added =~ /\b(\w+\.sh)\b/g;
is_deeply([sort keys %files], [qw(sigchld.sh signal.sh subshell.sh)],
'the patch touches only signal.sh, subshell.sh and sigchld.sh');