mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
yes: fix argv test race between fork and exec
The argv test checks ps(1) output immediately after backgrounding yes(1), but the forked child briefly shows the parent shell's argv before exec(2) replaces it. This caused intermittent failures where ps(1) captured the atf shell wrapper command line instead of "yes y". Approved by: des Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D56231
This commit is contained in:
1 parent
63d0e3e3aa
commit
c5961b6fcf
1 file changed
+2
@@ -52,6 +52,8 @@ argv_body()
|
||||
{
|
||||
yes y >/dev/null &
|
||||
local pid=$!
|
||||
# Wait for yes(1) to exec before checking args
|
||||
sleep 0.1
|
||||
atf_check -o inline:"yes y\n" ps -o args= $pid
|
||||
kill $pid
|
||||
wait
|
||||
|
||||
Reference in new issue
Block a user