NetBSD Problem Report #58567

From www@netbsd.org  Sat Aug 10 13:16:27 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5804A1A9243
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Aug 2024 13:16:27 +0000 (UTC)
Message-Id: <20240810131626.17C651A9244@mollari.NetBSD.org>
Date: Sat, 10 Aug 2024 13:16:26 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: t_random_garbage writes random garbage to /tmp
X-Send-Pr-Version: www-1.0

>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).

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.