[Fedora-packaging] Draft to prohibit use of #!/usr/bin/env

Ralf Corsepius rc040203 at freenet.de
Wed Jul 22 07:25:35 UTC 2009


On 07/22/2009 08:54 AM, Braden McDaniel wrote:
> On Fri, 2009-07-17 at 01:54 -0700, Toshio Kuratomi wrote:
>> https://fedoraproject.org/wiki/Script_Interpreters_(draft)
>>
>> I've just submitted this draft.  This seems to support the following
>> feature which I need to find the owner of and coordinate with:
>
> The problem I see with this is that it's bound to result in patches that
> some upstream developers will find unpalatable.  Can non-Fedora-specific
> arguments be made against this practice *that are sufficiently
> compelling to justify the potential for long-term maintenance of
> patches*?
Well, the primary reason for using #!/usr/bin/env is script-portability 
to support cases, in which using a hard-coded interpreter is not feasible.

Such cases typically are

a) there is no "standardized location" for an interpreter.
e.g. though presuming presence of /bin/bash is pretty safe on Linuxes, 
there is no "standardized location" for bash on "non" Linuxes.

b) /usr/bin/env is handy for cases in which not using the "standard 
interpreter" is not desired.
Examples would be
- testing/development purposes (e.g. when developing on such an 
interpreter, e.g. a new bash)
- testsuites to be run inside of a package. They typically want to use 
the newly built interpreter and do not the system-wide version.

As b) is suiteable for distribution and development purposes, it is a 
pretty compelling approach to keep a package simple on the developer's part.

> I say, "non-Fedora-specific" because this is a lot more compelling if
> the project can say, unequivocally, that Fedora is taking a stand
> against a generally harmful practice.  If, however, the reasons driving
> this are mostly Fedora-specific, it's a harder sell.  Broadly speaking,
> a distribution like Fedora should be doing its best to adapt to what
> upstream developers deliver.
IMO, /usr/bin/env is not necessarily harmful. It may cause undesired 
side-effects if being carelessly used.

That said, my attitude on this is ambivalent and I am not convinced, 
banning /usr/bin/env is a good idea.

One one hand, banning /usr/bin/env restricts the distro and helps 
assuring consistency withing the distro, on the other hand, it restricts 
usability of distro (for development purposes) and forces either 
developers or packagers to _generating_ scripts.


Ralf





More information about the Fedora-packaging mailing list