Subject: bin/13762: should not /etc/rc.d/bootconf.sh avoid using egrep ?
To: None <gnats-bugs@gnats.netbsd.org>
From: Stoned Elipot <seb@pbox.org>
List: netbsd-bugs
Date: 08/21/2001 01:23:04
>Number:         13762
>Category:       bin
>Synopsis:       /etc/rc.d/bootconf.sh uses egrep when it may not be available
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 20 16:20:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Stoned Elipot
>Release:        NetBSD 1.5.1
>Organization:
Pandore's Box <pbox.org>
>Environment:
System: NetBSD runabout 1.5.1 NetBSD 1.5.1 (RUNABOUT) #0: Sun Aug 19 02:24:21 CEST 2001     seb@runabout:/site/src/sys/arch/i386/compile/RUNABOUT i386

>Description:
/etc/rc.d/bootconf.sh uses egrep which is of course /usr/bin/egrep. If one
does not put a static egrep in say /bin or add /usr to 
$critical_filesystems_beforenet bootconf.sh's variable conflist is
not initialized properly, or am I wrong?...
>How-To-Repeat:
Run newbtconf init, reboot and watch the messages before bootconf.sh prompts
for the configuration to use (make sure you don't have a egrep in /bin
or /sbin or that /usr is not listed in $critical_filesystems_beforenet :)
>Fix:
the following fix aims to get ride of egrep usage in bootconf.sh

--- /etc/rc.d.orig/bootconf.sh.orig	Tue Aug 21 00:19:37 2001
+++ /etc/rc.d/bootconf.sh	Tue Aug 21 00:21:10 2001
@@ -21,9 +21,12 @@
 		default=current
 	fi
 	spc=""
-	conflist=`cd /etc; ls -1d etc.* 2>&1 | egrep -v "current|default"`
+	conflist=`cd /etc; ls -1d etc.* 2>&1`
 	for i in $conflist; do
 		name=${i#etc.}
+		case "$name" in
+			default|current) continue ;;
+		esac
 		if [ "$name" = "$default" ]; then
 			echo -n "${spc}[${name}]"
 		else
>Release-Note:
>Audit-Trail:
>Unformatted: