[Bug 248865] rc script in /usr/local/etc/rc.d/ may be ignored

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 24 04:23:09 UTC 2020


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

            Bug ID: 248865
           Summary: rc script in /usr/local/etc/rc.d/ may be ignored
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: unitrunker at gmail.com

rc.subr uses grep to look for rc scripts with '^# PROVIDE:'

See "find_local_scripts_new" and "find_local_scripts_old".

RC scripts in /usr/local/etc/rc.d/* without the "# PROVIDE:" clause are ignored
by /etc/rc.

I think this is a mistake. Per the docs, the "PROVIDE" clause is optional. This
is certainly the case for rc scripts in base (eg. /etc/rc.d/).

To fix this, either ...

1. Update the docs (see bug
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=121440).

Note that an empty "# PROVIDE:" clause will work. Only scripts under
/usr/local/etc/rc.d/ are affected by this quirk.

... or ...

2. Update rc.subr to detect scripts that contain ANY of the well-known rc
script clauses: PROVIDE, REQUIRE, BEFORE, or KEYWORD (or some other heuristic
to detect a valid RC script).

In any case, the documentation should be updated to say that - because /usr may
not yet be mounted when /etc/rc first runs, scripts under /usr/local are not
visible. Such scripts are run in a second pass made by /etc/rc (after the root
file system has been made read-write). This has the same effect as adding ...

# REQUIRE: FILESYSTEMS

... to any RC script under /usr/local/etc/rc.d/

The reason is /etc/rc only runs scripts up to and including FILESYSTEMS in the
first pass.

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


More information about the freebsd-bugs mailing list