Do not use #! /usr/bin/env INTERPRETER
Fedora ships with only a single version of most interpreters (python, perl, php, etc). The application packages we build all target this version. However, the end user may install other versions of the interpreter to satisfy their own requirements. For instance, Fedora 11 ships with /usr/bin/python which is python-2.6. The user may need to run Zope on their machine which necessitates python-2.4. They can install this in /usr/local/bin and point their zope instance at it.
This strategy works well when the applications we ship use a shebang line that directly calls the interpreter like this: #! /usr/bin/python
as there's no ambiguitiy in which version of python the packages will invoke. When we use #! /usr/bin/env python
in the shebang line, there is ambiguity. Depending on the user's PATH variable, they may end up invoking the python that we ship or the copy that they've installed. This can lead to breakage where the application is not compatible with both versions of the interpreter.
Also, RPM does dependency additions based on script interpreter lines. If a script has #! /usr/bin/env python
, the dependency added to the resulting rpm is on /usr/bin/env, not on the actual python interpreter. This may lead to incorrect dependencies, and broken scripts.
For these reasons, Fedora packages must not use /usr/bin/env
to invoke the interpreter in the shebang line.
Fixing
This is a Guideline change that would be good to fix old packages. The way to detect what packages need fixing is to look for packages in the current collection that depend on (/usr)?/bin/env
.
$ repoquery --qf="%{sourcerpm}" --disablerepo=\* --enablerepo=rawhide \ --whatrequires {/usr,}/bin/env |sort -u > env-issues.lst $ wc -l env-issues.lst 424