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

Rob Pitt rob at oxdi.co.uk
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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 14 10:40:16 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Rob Pitt
>Release:        6.0
>Organization:
Oxygen Digital Industries Ltd
>Environment:
6.0 RELEASE
>Description:
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.:

#!/usr/local/bin/python

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.
>How-To-Repeat:
1. See description
>Fix:
The rc.subr script could assume that "foobar" is the correct interpreter value when it sees "#!/usr/bin/env foobar"
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list