Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2025 22:51:08 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e1a3b7ff9fe6 - stable/14 - pkill tests: Fix pkill usage in the pkill -x test
Message-ID:  <202504062251.536Mp8pW077019@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e1a3b7ff9fe6152b4a112cc47c5155c4c9da9b74

commit e1a3b7ff9fe6152b4a112cc47c5155c4c9da9b74
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-03-15 11:12:45 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-04-06 13:54:03 +0000

    pkill tests: Fix pkill usage in the pkill -x test
    
    The target process name(s) mark the beginning of the command's
    positional parameters, so the -P filter wasn't getting applied as
    intended.  As a result, the second "pkill -x sleep -P $$" would kill all
    sleep(1) processes in the system, which can cause problems when running
    tests in parallel.
    
    MFC after:      2 weeks
    
    (cherry picked from commit 57b09e470dbd84d1491a8972cf504b25e788a6c3)
---
 bin/pkill/tests/pkill-x_test.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/pkill/tests/pkill-x_test.sh b/bin/pkill/tests/pkill-x_test.sh
index 9247a85863c0..5fe751f9ec72 100644
--- a/bin/pkill/tests/pkill-x_test.sh
+++ b/bin/pkill/tests/pkill-x_test.sh
@@ -9,13 +9,13 @@ sleep=$(pwd)/sleep.txt
 ln -sf /bin/sleep $sleep
 $sleep 5 &
 sleep 0.3
-pkill -x slee -P $$
+pkill -P $$ -x slee
 if [ $? -ne 0 ]; then
 	echo "ok 1 - $name"
 else
 	echo "not ok 1 - $name"
 fi
-pkill -x sleep -P $$
+pkill -P $$ -x sleep
 if [ $? -eq 0 ]; then
 	echo "ok 2 - $name"
 else
@@ -28,13 +28,13 @@ sleep=$(pwd)/sleep.txt
 ln -sf /bin/sleep $sleep
 $sleep 5 &
 sleep 0.3
-pkill -x -f "$sleep " -P $$
+pkill -P $$ -x -f "$sleep "
 if [ $? -ne 0 ]; then
 	echo "ok 3 - $name"
 else
 	echo "not ok 3 - $name"
 fi
-pkill -x -f "$sleep 5" -P $$
+pkill -P $$ -x -f "$sleep 5"
 if [ $? -eq 0 ]; then
 	echo "ok 4 - $name"
 else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504062251.536Mp8pW077019>