NetBSD Problem Report #58568

From www@netbsd.org  Sat Aug 10 13:18:19 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)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C89EF1A9242
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Aug 2024 13:18:18 +0000 (UTC)
Message-Id: <20240810131627.E49501A9244@mollari.NetBSD.org>
Date: Sat, 10 Aug 2024 13:16:27 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: t_tcpdump leaves garbage in /tmp
X-Send-Pr-Version: www-1.0

>Number:         58568
>Category:       misc
>Synopsis:       t_tcpdump leaves garbage in /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:02 +0000 2024
>Last-Modified:  Tue Mar 04 20:05:01 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The /tmp/NetBSD.3EZCqp Foundacheck
>Environment:
>Description:
Running /usr/tests/usr.sbin/tcpdump/t_tcpdump leaves a temporary directory in /tmp/check.XXXXXX, where XXXXXX is randomly generated each time, having two regular files called `stderr' and `stdout'.

This is probably because the test starts an atf-check(1) process running tcpdump in the background, and then kills that process.  I have no idea what this is supposed to achieve (surely if you kill the atf-check(1) process, it doesn't actually check anything?), but I suspect that killing the atf-check(1) process makes it skip the tempfile cleanup.
>How-To-Repeat:
cd /usr/tests/usr.sbin/tcpdump && atf-run t_tcpdump | atf-report
>Fix:
Yes, please!

Maybe just skip the intermediate atf-check and run tcpdump directly?

>Audit-Trail:
From: Attaullah <mdattaullahansari152@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: misc/58568: t_tcpdump leaves garbage in /tmp
Date: Wed, 5 Mar 2025 01:32:08 +0530

 The test's purpose is to toggle promiscuous mode via tcpdump -c 1,
 which directly invokes the ioctl(SIOCSIFFLAGS) kernel interface. Using
 atf-check to run tcpdump in the background with the '-s/-o/-e ignore'
 flags made it behave like direct execution while leaking
 /tmp/check.XXXXXX directories when terminated. Replacing it with
 direct execution should not alter the test's behavior.

 diff --git a/tests/usr.sbin/tcpdump/t_tcpdump.sh
 b/tests/usr.sbin/tcpdump/t_tcpdump.sh
 index 5cd89b41abe4..38e4edc8a4fb 100644
 --- a/tests/usr.sbin/tcpdump/t_tcpdump.sh
 +++ b/tests/usr.sbin/tcpdump/t_tcpdump.sh
 @@ -28,8 +28,11 @@
  # POSSIBILITY OF SUCH DAMAGE.
  #
  prom() {
 -    atf_check -s ignore -o ignore -e ignore -x "tcpdump -c 1 -i $1" &
 -    sleep 2; kill $! >/dev/null 2>&1
 +    tcpdump -c 1 -i "$1" >/dev/null 2>&1 &
 +    pid=$!
 +    sleep 2
 +    kill "$pid" 2>/dev/null || :
 +    wait "$pid" 2>/dev/null || :
  }

  atf_test_case promiscuous

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.