misc/185429: rc.subr: ${name}_chroot does not work when there's a custom rc "start_cmd"

Dreamcat4 dreamcat4 at gmail.com
Thu Jan 2 23:30:01 UTC 2014


>Number:         185429
>Category:       misc
>Synopsis:       rc.subr: ${name}_chroot does not work when there's a custom rc "start_cmd"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 02 23:30:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Dreamcat4
>Release:        9.1-RELEASE-p5 and higher
>Organization:
-
>Environment:
This bug occurs for any / all recent FreeBSD versions since 9.1-RELEASE-p5
>Description:
There is a bug in /etc/rc.subr

the bug is:
if [ there's a custom ${XXX_cmd}, ]
  E.g. an rc "start_cmd", "stop_cmd".

then 
  "${name}_chroot" does not work.

Documentation:
man -Pcat rc.subr | grep -5 -i chroot

 ${name}_chroot
   Directory to chroot(8) to before running command.
   Only supported after /usr is mounted.


It happens at these begin/end points:

https://gitorious.org/freebsd/freebsd/source/1e0e806b8822c4570e09508df054f82f9a47ce0e:etc/rc.subr#L684-739

If you look in rc.subr at those lines ^^ control is obviously never getting to the part where it kicks of the chroot case... which only happens in case start).

There may be more bugs nearby, and for the same reason.
Will fix / wont fix ?

Many thanks.

>How-To-Repeat:
for any rc.d service that sets "start_cmd" at the top of its rc.d script

1) set "${name}_chroot=/path/to/chroot" in rc.conf
2) set "name_enable=YES" in rc.conf
3) start that rc.d service


>Fix:
need to edit the file "/etc/rc.subr" around these lines:

https://gitorious.org/freebsd/freebsd/source/1e0e806b8822c4570e09508df054f82f9a47ce0e:etc/rc.subr#L684-739

So that ${name}_chroot is checked for, even at the top where it says:

"# if there's a custom ${XXX_cmd},"
...

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list