/etc/rc.subr contains the following snippet: for _d in /etc ${local_startup%*/rc.d}; do if [ -f ${_d}/rc.conf.d/"$_name" ]; then debug "Sourcing ${_d}/rc.conf.d/$_name" . ${_d}/rc.conf.d/"$_name" However, as local_startup can contain more than one path, only the last entry has "/rc.d" stripped correctly, thus making the rc.conf.d directories invalid for other entries. This patch fixes it. Example, before patch: 0:02 (99) "/etc" root@lapcat# grep local_startup /etc/rc.conf local_startup="/usr/local/etc/rc.d /usr/common/etc/rc.d /usr/me/etc/rc.d" # startup script dirs. 23:48 (42) "/etc" root@lapcat# service lpd restart + [ -f /etc/rc.conf.d/XXX ] + [ -d /etc/rc.conf.d/XXX ] + [ -f /usr/local/etc/rc.d/rc.conf.d/XXX ] + [ -d /usr/local/etc/rc.d/rc.conf.d/XXX ] + [ -f /usr/common/etc/rc.d/rc.conf.d/XXX ] + [ -d /usr/common/etc/rc.d/rc.conf.d/XXX ] + [ -f /usr/me/etc/rc.conf.d/XXX ] + [ -d /usr/me/etc/rc.conf.d/XXX ] + [ -f /etc/rc.conf.d/lpd ] + [ -d /etc/rc.conf.d/lpd ] + [ -f /usr/local/etc/rc.d/rc.conf.d/lpd ] + [ -d /usr/local/etc/rc.d/rc.conf.d/lpd ] + [ -f /usr/common/etc/rc.d/rc.conf.d/lpd ] + [ -d /usr/common/etc/rc.d/rc.conf.d/lpd ] + [ -f /usr/me/etc/rc.conf.d/lpd ] + [ -d /usr/me/etc/rc.conf.d/lpd ] Example, after patch: 23:49 (43) "/etc" root@lapcat# service lpd restart + _d=/etc + [ -f /etc/rc.conf.d/XXX ] + [ -d /etc/rc.conf.d/XXX ] + _d=/usr/local/etc + [ -f /usr/local/etc/rc.conf.d/XXX ] + [ -d /usr/local/etc/rc.conf.d/XXX ] + _d=/usr/common/etc + [ -f /usr/common/etc/rc.conf.d/XXX ] + [ -d /usr/common/etc/rc.conf.d/XXX ] + _d=/usr/me/etc + [ -f /usr/me/etc/rc.conf.d/XXX ] + [ -d /usr/me/etc/rc.conf.d/XXX ] + _d=/etc + [ -f /etc/rc.conf.d/lpd ] + [ -d /etc/rc.conf.d/lpd ] + _d=/usr/local/etc + [ -f /usr/local/etc/rc.conf.d/lpd ] + [ -d /usr/local/etc/rc.conf.d/lpd ] + _d=/usr/common/etc + [ -f /usr/common/etc/rc.conf.d/lpd ] + [ -d /usr/common/etc/rc.conf.d/lpd ] + _d=/usr/me/etc + [ -f /usr/me/etc/rc.conf.d/lpd ] + [ -d /usr/me/etc/rc.conf.d/lpd ] This problem exists in 10-STABLE and 11-CURRENT As an aside, a commit to rc.subr by des 7 months ago, scheduled to be MFC after a week still hasn't bern actioned: base r275359 | des | Date: Mon Dec 1 12:17:42 2014 UTC (7 months, 2 weeks ago) | Log Message: Allow load_rc_config to be called without a service name. | | MFC after: 1 week Cheers, Jamie
Created attachment 158897 [details] fix to /etc/rc.subr
A commit references this bug: Author: jilles Date: Sat Aug 1 22:00:26 UTC 2015 New revision: 286163 URL: https://svnweb.freebsd.org/changeset/base/286163 Log: rc.subr: Allow rc.conf.d with multi-directory local_startup. I also changed ${...%*/rc.d} to ${...%/rc.d} since the shortest match always has an empty string for the asterisk. PR: 201641 Submitted by: Jamie Landeg-Jones (original version) MFC after: 1 week Changes: head/etc/rc.subr
Cheers! > I also changed ${...%*/rc.d} to ${...%/rc.d} since the shortest match always has an empty string for the asterisk. Oops, yes, good catch! I moved that from the original code, but missed the unnecessary asterisk! Thanks, Jamie
A commit references this bug: Author: jilles Date: Tue Oct 27 20:58:14 UTC 2015 New revision: 290062 URL: https://svnweb.freebsd.org/changeset/base/290062 Log: MFC r286163: rc.subr: Allow rc.conf.d with multi-directory local_startup. I also changed ${...%*/rc.d} to ${...%/rc.d} since the shortest match always has an empty string for the asterisk. PR: 201641 Submitted by: Jamie Landeg-Jones (original version) Changes: _U stable/10/ stable/10/etc/rc.subr