git: aab7f19974a2 - main - sh tests: Fix ktrace usage now that envvars are traced by default

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 17 Nov 2024 17:42:19 UTC
The branch main has been updated by markj:

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

commit aab7f19974a27cac3c1088f486074c05bf95017a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-17 17:37:34 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-17 17:37:34 +0000

    sh tests: Fix ktrace usage now that envvars are traced by default
    
    Some sh tests use ktrace to see whether a particular file, specified in
    the environment, was accessed by the shell.  After commit 65a4daeaf324,
    this test matches the ktrace record generated by execve.
    
    Use ktrace to only log name lookups, to avoid such false matches.
    
    Fixes:  65a4daeaf324 ("ktrace: log execve(2) arguments and environment")
---
 bin/sh/tests/parameters/mail1.0 | 2 +-
 bin/sh/tests/parameters/mail2.0 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/sh/tests/parameters/mail1.0 b/bin/sh/tests/parameters/mail1.0
index 09102d811513..42e712e31ac9 100644
--- a/bin/sh/tests/parameters/mail1.0
+++ b/bin/sh/tests/parameters/mail1.0
@@ -3,7 +3,7 @@
 goodfile=/var/empty/sh-test-goodfile
 mailfile=/var/empty/sh-test-mailfile
 T=$(mktemp sh-test.XXXXXX) || exit
-MAIL=$mailfile ktrace -i -f "$T" ${SH} -c "[ -s $goodfile ]" 2>/dev/null
+MAIL=$mailfile ktrace -t n -i -f "$T" ${SH} -c "[ -s $goodfile ]" 3>/dev/null
 if ! grep -q $goodfile "$T"; then
 	# ktrace problem
 	rc=0
diff --git a/bin/sh/tests/parameters/mail2.0 b/bin/sh/tests/parameters/mail2.0
index d594c4a74356..b1f48e0b29db 100644
--- a/bin/sh/tests/parameters/mail2.0
+++ b/bin/sh/tests/parameters/mail2.0
@@ -3,7 +3,7 @@
 goodfile=/var/empty/sh-test-goodfile
 mailfile=/var/empty/sh-test-mailfile
 T=$(mktemp sh-test.XXXXXX) || exit
-ENV=$goodfile MAIL=$mailfile ktrace -i -f "$T" ${SH} +m -i </dev/null >/dev/null 2>&1
+ENV=$goodfile MAIL=$mailfile ktrace -t n -i -f "$T" ${SH} +m -i </dev/null >/dev/null 2>&1
 if ! grep -q $goodfile "$T"; then
 	# ktrace problem
 	rc=0