bin/100287: /etc/rc.subr cannot deal properly with interpreted daemons whos shebang uses /usr/bin/env

Rob Pitt rob at
Fri Jul 14 10:40:18 UTC 2006

>Number:         100287
>Category:       bin
>Synopsis:       /etc/rc.subr cannot deal properly with interpreted daemons whos shebang uses /usr/bin/env
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 14 10:40:16 GMT 2006
>Originator:     Rob Pitt
>Release:        6.0
Oxygen Digital Industries Ltd
When you create a script to manage starting and stopping a daemon written in an interpreted language then you supply command_interpreter to set the interpreter being used to execute the daemon (i.e. /usr/local/bin/python). If the interpreted daemon uses a shebang referencing /usr/bin/env to locate it's interpreter (a good practice for a multi-platform daemon), i.e.:

#!/usr/bin/env python

Then the rc.subr script gets confused because it thinks the interpreter is "/usr/bin/env " (including that last space).

You can work around this by changing the daemons shebang to point at the actual location of the interpreter, i.e.:


However, while trivial this is far from ideal because it means additional, unnecessary patching and the rc.subr script could be made to handle this gracefully.
1. See description
The rc.subr script could assume that "foobar" is the correct interpreter value when it sees "#!/usr/bin/env foobar"

More information about the freebsd-bugs mailing list