From c7be7e20f6212fc2633813dbfad2a0e71ef79c07 Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Sun, 31 Dec 2006 11:07:29 +0000 Subject: [PATCH] Allow for /usr/bin/env when parsing the shebang line from an interpreted $command. Some "portable" sofware packages use such a line to skip the task of figuring out the absolute pathname of the interpreter at install time, e.g.: #!/usr/bin/env python It is insecure, but a popular book on Python seems to have advised it to a wide audience. Hence a number of such scripts in the ports, mostly written in Python. PR: bin/100287 MFC after: 1 week --- etc/rc.subr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/rc.subr b/etc/rc.subr index a33c07fe9a62..e938cbc065b1 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -264,6 +264,11 @@ _find_processes() read _interp < ${_chroot:-}/$_procname # read interpreter name _interp=${_interp#\#!} # strip #! set -- $_interp + case $1 in + */bin/env) + shift # drop env to get real name + ;; + esac if [ $_interpreter != $1 ]; then warn "\$command_interpreter $_interpreter != $1" fi