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:
Yaroslav Tykhiy 2006-12-31 11:07:29 +00:00
parent 0c30639059
commit c7be7e20f6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=165684

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