NetBSD Problem Report #60836
From www@netbsd.org Fri Oct 2 02:49:08 2026
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 "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 32FE91A923B
for <gnats-bugs@gnats.NetBSD.org>; Fri, 2 Oct 2026 02:49:08 +0000 (UTC)
Message-Id: <20261002024906.B86891A923C@mollari.NetBSD.org>
Date: Fri, 2 Oct 2026 02:49:06 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: /etc/rc.d/network picks up stray ifconfig.ifN~ backup files
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 60836
>Category: misc
>Synopsis: /etc/rc.d/network picks up stray ifconfig.ifN~ backup files
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: riastradh
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 02 02:50:00 +0000 2026
>Closed-Date:
>Last-Modified: Fri Oct 02 14:17:40 +0000 2026
>Originator: Taylor R Campbell
>Release: 11
>Organization:
Network BSD Backups Ifc.
>Environment:
>Description:
I changed /etc/ifconfig.wg0 and saved a backup as
/etc/ifconfig.wg0.~1~ as is a common convention; the next
`service network restart' complained:
Starting network.
Hostname: nanocons.local
IPv6 mode: host
Configuring network interfaces: emac0 wg0 ~1~ifconfig: clone_command: Invalid argument
ifconfig: exec_matches: Invalid argument
usage: ifconfig [-h] [-m] [-v] [-z] [-L] interface
...
ifconfig interface destroy
.
Adding interface aliases:.
The relevant logic in /etc/rc.d/network looks like it was maybe
intended as a regular expression, not a shell glob:
242 for cloner in $(/sbin/ifconfig -C); do
243 for int in /etc/ifconfig.${cloner}[0-9]*; do
244 [ ! -f $int ] && break
245 tmp="$tmp ${int##*.}"
246 done
247 done
https://nxr.netbsd.org/xref/src/etc/rc.d/network?r=1.85#242
This will also get confused by ifconfig.wg0.bak,
ifconfig.wg0.tmp, &c.
>How-To-Repeat:
touch /etc/ifconfig.wg0.~1~
service network restart
>Fix:
1. Check for ${cloner}[0-9]* (or, really, ${cloner}[0-9][0-9]*)
as a regular expression, e.g. with expr(1)?
2. Check for *~ and skip it?
>Release-Note:
>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: misc/60836: /etc/rc.d/network picks up stray ifconfig.ifN~ backup files
Date: Fri, 02 Oct 2026 10:54:54 +0700
Date: Fri, 2 Oct 2026 02:50:01 +0000 (UTC)
From: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
Message-ID: <20261002025001.7B4B61A923E@mollari.NetBSD.org>
| 1. Check for ${cloner}[0-9]* (or, really, ${cloner}[0-9][0-9]*)
| as a regular expression, e.g. with expr(1)?
RE not needed, a suitable (adequate for the purpose here, if not
100% general case for all purposes) fix can be done using just sh.
| 2. Check for *~ and skip it?
That's insufficient, using ~ might be "a common convention" in some
environments, but there are also .bak .orig and numerous others
floating around - if we're to deal with one, we should deal with all.
Of course, just saving the pre-modified file in RCS or CVS or something
and not cluttering the filesystem with various "backup" files would be
a much better solution, but ...
kre
Responsible-Changed-From-To: misc-bug-people->kre
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Fri, 02 Oct 2026 04:34:24 +0000
Responsible-Changed-Why:
local sh wizard has stepped in to show us How It's Done using just sh
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60836 CVS commit: src/etc/rc.d
Date: Fri, 2 Oct 2026 06:53:07 +0000
Module Name: src
Committed By: kre
Date: Fri Oct 2 06:53:07 UTC 2026
Modified Files:
src/etc/rc.d: network
Log Message:
PR misc/60836 - Be more careful with /etc/ifconfig.* cloner configs
Only config cloner interfaces when an /etc/ifconfig.${cloner}N file
exists, if N is completely numeric.
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/etc/rc.d/network
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: kre@NetBSD.org
State-Changed-When: Fri, 02 Oct 2026 06:56:34 +0000
State-Changed-Why:
Fixed.
State-Changed-From-To: closed->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 02 Oct 2026 14:01:48 +0000
State-Changed-Why:
pullup-11 at least would be nice
Responsible-Changed-From-To: kre->riastradh
Responsible-Changed-By: kre@NetBSD.org
Responsible-Changed-When: Fri, 02 Oct 2026 14:17:40 +0000
Responsible-Changed-Why:
No wizardry needed for pullups, so
returning responsibility for this to riastradh
>Unformatted:
(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.