diff options
| author | Olivier Cochard <olivier@FreeBSD.org> | 2026-04-06 17:17:49 +0000 |
|---|---|---|
| committer | Olivier Cochard <olivier@FreeBSD.org> | 2026-04-06 17:22:25 +0000 |
| commit | c5961b6fcfe0f3587be11187a9c666a7fa200f4b (patch) | |
| tree | 6c03ee3412824854c7f7f46ca530028009af7634 | |
| parent | 63d0e3e3aa2483420f828686336d6615616363d5 (diff) | |
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
| -rw-r--r-- | usr.bin/yes/tests/yes_test.sh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/yes/tests/yes_test.sh b/usr.bin/yes/tests/yes_test.sh index f4c04e186536..797ac5f6ac9f 100644 --- a/usr.bin/yes/tests/yes_test.sh +++ b/usr.bin/yes/tests/yes_test.sh @@ -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 |
