Subject: misc/32545: rc.d/lkm[123] unnecessarily fork subshells
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <j+nbsd@2006.salmi.ch>
List: netbsd-bugs
Date: 01/16/2006 13:30:00
>Number:         32545
>Category:       misc
>Synopsis:       rc.d/lkm[123] unnecessarily fork subshells
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 16 13:30:00 +0000 2006
>Originator:     Jukka Salmi
>Release:        NetBSD 3.99.15
>Environment:
System: NetBSD moray.salmi.ch 3.99.15 NetBSD 3.99.15 (GENERIC.APM) #0: Sun Jan 15 16:37:50 CET 2006 build@moray.salmi.ch:/build/nbsd/i386/sys/arch/i386/compile/GENERIC.APM i386
Architecture: i386
Machine: i386
>Description:
The three init script /etc/rc.d/lkm[123] all run `/etc/rc.d/sysdb
devdb' on startup. They all run it in subshells - this causes
/etc/rc.conf being read multitple times even if $_rc_conf_loaded is
set to `true'.
>How-To-Repeat:
Set lkm=YES, add e.g. an echo statement to /etc/rc.conf, and wonder
why it is output several times...
>Fix:

Index: etc/rc.d/lkm1
===================================================================
RCS file: /cvsroot/src/etc/rc.d/lkm1,v
retrieving revision 1.8
diff -u -p -r1.8 lkm1
--- etc/rc.d/lkm1	13 Aug 2004 18:08:03 -0000	1.8
+++ etc/rc.d/lkm1	16 Jan 2006 13:09:12 -0000
@@ -26,7 +26,7 @@ lkm1_start()
 		fi
 	fi
 
-	/etc/rc.d/sysdb devdb
+	set devdb ; . /etc/rc.d/sysdb
 }
 
 lkm1_stop()
Index: etc/rc.d/lkm2
===================================================================
RCS file: /cvsroot/src/etc/rc.d/lkm2,v
retrieving revision 1.6
diff -u -p -r1.6 lkm2
--- etc/rc.d/lkm2	13 Aug 2004 18:08:03 -0000	1.6
+++ etc/rc.d/lkm2	16 Jan 2006 13:09:12 -0000
@@ -24,7 +24,7 @@ lkm2_start()
 		warn "/etc/rc.lkm not found; LKMs not loaded."
 	fi
 
-	/etc/rc.d/sysdb devdb
+	set devdb ; . /etc/rc.d/sysdb
 }
 
 lkm2_stop()
Index: etc/rc.d/lkm3
===================================================================
RCS file: /cvsroot/src/etc/rc.d/lkm3,v
retrieving revision 1.8
diff -u -p -r1.8 lkm3
--- etc/rc.d/lkm3	13 Aug 2004 18:08:03 -0000	1.8
+++ etc/rc.d/lkm3	16 Jan 2006 13:09:12 -0000
@@ -23,7 +23,7 @@ do_lkm3()
 		set $1 ; . /etc/rc.lkm
 	fi
 
-	/etc/rc.d/sysdb devdb
+	set devdb ; . /etc/rc.d/sysdb
 }
 
 load_rc_config lkm