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
This commit is contained in:
yar 2006-12-31 11:07:29 +00:00
parent dc9f8423c3
commit 0a888a1e57

View File

@ -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