NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/58567: t_random_garbage writes random garbage to /tmp



>Number:         58567
>Category:       misc
>Synopsis:       t_random_garbage writes random garbage to /tmp
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 10 13:20:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10
>Organization:
The /tmp/NetBSD.out Foundation
>Environment:
>Description:
The test case sbin/sysctl/t_random_garbage writes to a file /tmp/sysctl.out in the _test head_, not the test body, even if the test is skipped, and it never cleans the file up:

     30 tmp="/tmp/sysctl.out"
...
     40 atf_test_case random_garbage cleanup
     41 random_garbage_head() {
     42 	sysctl -a > $tmp
     43 	atf_set "require.user" "root"
     44 	atf_set "descr" "Test writing random garbage " \
     45 		"to sysctl nodes (PR kern/55451)"
     46 }
     47 
     48 random_garbage_body() {
     49 
     50 	if ! [ $(atf_config_get "run_unsafe" "no") = "yes" ]; then
     51 		atf_skip "The test is not safe (PR kern/55451)"
     52 	fi
     53 
     54 	while read line; do
...
     87 	done < $tmp
     88 }

https://nxr.netbsd.org/xref/src/tests/sbin/sysctl/t_random_garbage.sh#30

It's unclear to me why it does any writes in the test head, and why it uses /tmp, and why it has a temporary file at all.
>How-To-Repeat:
cd /usr/tests/sbin/sysctl && atf-run t_random_garbage | atf-report
>Fix:
Yes, please!  Maybe just delete the test?  Unclear what value it provides as an automatic test, since it's basically designed to unrecoverably screw up the kernel configuration, so it is always skipped (PR kern/55451: https://gnats.NetBSD.org/55451).



Home | Main Index | Thread Index | Old Index