From c3b47276a22aa4d0266d2a558654c26e986184e8 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 28 Sep 2023 11:50:20 -0700 Subject: [PATCH 1/4] testsuite: fix bashism Problet: t2001-imp-kill.t contains a bash expression in a script that is run by /bin/sh. Use an expression that should work in all POSIX shells. --- t/t2001-imp-kill.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2001-imp-kill.t b/t/t2001-imp-kill.t index 0f57f800..8e44f0c1 100755 --- a/t/t2001-imp-kill.t +++ b/t/t2001-imp-kill.t @@ -161,7 +161,7 @@ waitfile() count=0 while ! grep "$2" $1 >/dev/null 2>&12>&1; do sleep 0.2 - let count++ + count=$(($count + 1)) test $count -gt 20 && break done grep "$2" $1 >/dev/null From f285f61fa34d63604dcabdb072f46ed4bde33f20 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 28 Sep 2023 11:51:31 -0700 Subject: [PATCH 2/4] testsuite: fix typo Problem: a test in t2001-imp-kill.t has a mangled redirect. Fix redirect. --- t/t2001-imp-kill.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2001-imp-kill.t b/t/t2001-imp-kill.t index 8e44f0c1..4a7e9b22 100755 --- a/t/t2001-imp-kill.t +++ b/t/t2001-imp-kill.t @@ -159,7 +159,7 @@ test "$(FLUX_IMP_CONFIG_PATTERN=sign-none.toml ./flux-imp kill 0 $$ \ waitfile() { count=0 - while ! grep "$2" $1 >/dev/null 2>&12>&1; do + while ! grep "$2" $1 >/dev/null 2>&1; do sleep 0.2 count=$(($count + 1)) test $count -gt 20 && break From 26d7886e4f9bcbb450d0bfae54a9e7753153dd2d Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 28 Sep 2023 12:03:36 -0700 Subject: [PATCH 3/4] testsuite: escape shell variable Problem: a script generated in t2001-imp-kill.t via hereis uses $! without escaping. Add a backslash. --- t/t2001-imp-kill.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2001-imp-kill.t b/t/t2001-imp-kill.t index 4a7e9b22..4756260a 100755 --- a/t/t2001-imp-kill.t +++ b/t/t2001-imp-kill.t @@ -174,7 +174,7 @@ test_expect_success NO_CHAIN_LINT,SUID_ENABLED,USER_CGROUP \ echo "\$@" printf "\$PPID\n" >$(pwd)/sleeper.pid /bin/sleep "\$@" & - pid=$! && + pid=\$! && trap "echo got SIGTERM; kill \$pid" SIGTERM wait echo sleep exited with \$? >&2 From 493dba2f95823d26ae34e85adb29052e1f86b1e8 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 28 Sep 2023 12:04:50 -0700 Subject: [PATCH 4/4] testsuite: fix trap statement Problem: a script generated in t2001-imp-kill.t with a shebang invoking /bin/sh includes a trap statement referencing SIGTERM, but this fails with "trap: SIGTERM: bad trap" s/SIGTERM/TERM/ Fixes #177 --- t/t2001-imp-kill.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2001-imp-kill.t b/t/t2001-imp-kill.t index 4756260a..796e95a3 100755 --- a/t/t2001-imp-kill.t +++ b/t/t2001-imp-kill.t @@ -175,7 +175,7 @@ test_expect_success NO_CHAIN_LINT,SUID_ENABLED,USER_CGROUP \ printf "\$PPID\n" >$(pwd)/sleeper.pid /bin/sleep "\$@" & pid=\$! && - trap "echo got SIGTERM; kill \$pid" SIGTERM + trap "echo got SIGTERM; kill \$pid" TERM wait echo sleep exited with \$? >&2 EOF