[Bug 201641] /etc/rc.subr error fails to parse rc.conf.d directories from $local_startup correctly

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jul 17 00:29:23 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201641

            Bug ID: 201641
           Summary: /etc/rc.subr error fails to parse rc.conf.d
                    directories from $local_startup correctly
           Product: Base System
           Version: 10.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: conf
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: jamie at dyslexicfish.net

/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 at 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 at 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 at 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

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list