git: c4700dbbf9b5 - stable/14 - pwait: Don't use init as a target

Dag-Erling Smørgrav <[email protected]> Mon, 03 Aug 2026 11:38:43 +0000
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a707dc3.1c1f5.2f200a1__25972.8156890318$1785757214$gmane$org@gitrepo.freebsd.org>
The branch stable/14 has been updated by des:

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

commit c4700dbbf9b56887208e2967eacdc98cba34aab2
Author:     Dag-Erling Smørgrav <[email protected]>
AuthorDate: 2026-07-25 12:44:35 +0000
Commit:     Dag-Erling Smørgrav <[email protected]>
CommitDate: 2026-08-03 11:32:13 +0000

    pwait: Don't use init as a target
    
    The time_unit test case uses PID 1 as a target for pwait.  This doesn't
    work in a jail.  Since all we need is a process that we know won't die
    while the test is running, we may as well use ourselves.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Sponsored by:   NetApp, Inc.
    Reviewed by:    ngie
    Differential Revision:  https://reviews.freebsd.org/D58418
    
    (cherry picked from commit 5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b)
---
 bin/pwait/tests/pwait_test.sh | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/bin/pwait/tests/pwait_test.sh b/bin/pwait/tests/pwait_test.sh
index d31ca21cff93..0d4f53d2941d 100644
--- a/bin/pwait/tests/pwait_test.sh
+++ b/bin/pwait/tests/pwait_test.sh
@@ -56,31 +56,29 @@ time_unit_head()
 
 time_unit_body()
 {
-	init=1
-
 	atf_check \
 		-o empty \
 		-e inline:"pwait: timeout unit\n" \
 		-s exit:65 \
-		timeout --preserve-status 2 pwait -t 1d $init
+		timeout --preserve-status 2 pwait -t 1d $$
 
 	atf_check \
 		-o empty \
 		-e inline:"pwait: timeout unit\n" \
 		-s exit:65 \
-		timeout --preserve-status 2 pwait -t 1d $init
+		timeout --preserve-status 2 pwait -t 1d $$
 
 	atf_check \
 		-o empty \
 		-e inline:"pwait: timeout value\n" \
 		-s exit:65 \
-		timeout --preserve-status 2 pwait -t -1 $init
+		timeout --preserve-status 2 pwait -t -1 $$
 
 	atf_check \
 		-o empty \
 		-e inline:"pwait: timeout value\n" \
 		-s exit:65 \
-		timeout --preserve-status 2 pwait -t 100000001 $init
+		timeout --preserve-status 2 pwait -t 100000001 $$
 
 	# These long duration cases are expected to timeout from the
 	# timeout utility rather than pwait -t.
@@ -88,37 +86,37 @@ time_unit_body()
 		-o empty \
 		-e empty \
 		-s signal:15 \
-		timeout --preserve-status 2 pwait -t 100000000 $init
+		timeout --preserve-status 2 pwait -t 100000000 $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s signal:15 \
-		timeout --preserve-status 2 pwait -t 1h $init
+		timeout --preserve-status 2 pwait -t 1h $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s signal:15 \
-		timeout --preserve-status 2 pwait -t 1.5h $init
+		timeout --preserve-status 2 pwait -t 1.5h $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s signal:15 \
-		timeout --preserve-status 2 pwait -t 1m $init
+		timeout --preserve-status 2 pwait -t 1m $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s signal:15 \
-		timeout --preserve-status 2 pwait -t 1.5m $init
+		timeout --preserve-status 2 pwait -t 1.5m $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s signal:15 \
-		timeout --preserve-status 2 pwait -t 0 $init
+		timeout --preserve-status 2 pwait -t 0 $$
 
 	# The rest are fast enough that pwait -t is expected to trigger
 	# the timeout.
@@ -126,31 +124,31 @@ time_unit_body()
 		-o empty \
 		-e empty \
 		-s exit:124 \
-		timeout --preserve-status 2 pwait -t 1s $init
+		timeout --preserve-status 2 pwait -t 1s $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s exit:124 \
-		timeout --preserve-status 2 pwait -t 1.5s $init
+		timeout --preserve-status 2 pwait -t 1.5s $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s exit:124 \
-		timeout --preserve-status 2 pwait -t 1 $init
+		timeout --preserve-status 2 pwait -t 1 $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s exit:124 \
-		timeout --preserve-status 2 pwait -t 1.5 $init
+		timeout --preserve-status 2 pwait -t 1.5 $$
 
 	atf_check \
 		-o empty \
 		-e empty \
 		-s exit:124 \
-		timeout --preserve-status 2 pwait -t 0.5 $init
+		timeout --preserve-status 2 pwait -t 0.5 $$
 }
 
 atf_test_case timeout_trigger_timeout