Subject: bin/14603: /sbin/newbtconf can re-init
To: None <>
From: None <>
List: netbsd-bugs
Date: 11/16/2001 07:33:48
>Number:         14603
>Category:       bin
>Synopsis:       /sbin/newbtconf can re-init
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 16 07:35:00 PST 2001
>Originator:     Robby Griffin
>Release:        NetBSD-1.5.2
NetBSD foiegras 1.5.2 NetBSD 1.5.2 (TERC_NETWORK_SERVER) #1: Fri Oct 19 20:09:52 EDT 2001     root@foiegras:/usr/src/sys/arch/i386/compile/TERC_NETWORK_SERVER i386
/sbin/newbtconf is a shell script for initializing new boot configurations. When you run it with the "init" argument, it creates the directory /etc/ and moves some config files in there, points the symlink /etc/etc.current at /etc/, and replaces the config files with symlinks to /etc/etc.current/foo. It's not supposed to redo this initialization when you run it with "init" again, but there's a typo in the script.

In particular, if you've gone on to create other boot configurations and  deleted /etc/, the script will fail to detect that /etc/etc.current still exists, because it looks for /etc/etc/current by mistake.

This is a minor bug since the effect is to create a bogus /etc/ filled with invalid symlinks instead of config files, and your real config files are still present in /etc/etc.<previousconfig>, but it would have the effect of changing the current config to the bogus at runtime; thus turning off DNS resolution and so forth.
/sbin/newbtconf init
/sbin/newbtconf mynewconfig network
# (reboot, select mynewconfig at prompt)
rm -rf /etc/
/sbin/newbtconf init
--- newbtconf.orig      Wed Aug 23 08:40:05 2000
+++ newbtconf   Fri Nov 16 10:30:13 2001
@@ -14,7 +14,7 @@
        rc.conf rc.conf.d resolv.conf"
 if [ $dir = init ] ; then
-       if [ -d /etc/ -o -e /etc/etc/current ] ; then
+       if [ -d /etc/ -o -e /etc/etc.current ] ; then
                echo "Error: multi-configuration already initialized"
                exit 1