[Python-Dev] Re: [ Patch #100719 ] Use '#!/usr/bin/env python' in scripts

Peter Funk pf@artcom-gmbh.de
Tue, 4 Jul 2000 12:31:34 +0200 (MEST)


Hi,

Fredrik Lundh :
> (just a heads up, not sure if SF was able to send
> out the notifications)
> 
> This patch suggests changing /usr/local/bin/python to
> /usr/bin/env python in cgi.py and faqwiz.py.   Note
> that both scripts are CGI scripts, and the FAQ has the
> following to say about that:
> 
>     http://www.python.org/doc/FAQ.html#4.63 
> 
>     Note -- *don't* do this for CGI scripts. The $PATH 
>     variable for CGI scripts is often very minimal, so 
>     you need to use the actual absolute pathname of
>     the interpreter.
> 
> -1, in other words (assuming that the FAQ is correct)

I agree (now).

I had submitted a similar patch at the beginning of this year, since
such a patch is also part of the diff files usually applied on the
major Linux distributions in order to build the Python binary RPMs
on these Systems (SuSE Linux, RedHat).

But I was conviced, that patching the official source tree would be a
bad idea, since this will break these CGI scripts on most traditional
Unices (e.g. Slowlaris), where people are unfortunately normally forced
to build Python on their own and might forget (or are not allowed)
to add /usr/local/bin to the default path.

Since all major Linux distributions however come with a properly patched
Python package anyway.  Python living in /usr/bin on all those boxes 
is no argument.

I believe applying such a patch has to wait until the proposed
"world domination" of Linux has become real. ;-)  

So ---at least today--- the FAQ entry is ---still--- somewhat correct.
However may be someone could add a note about prebuild Python RPMs to FAQ
4.63 in the mean time?  I believe that otherwise Linux people will
keep submitting patches like this one with increasing frequency.

At least our customers throw out their Sun Sparc and SGI boxes and
replace them with cheap Athlon or PIII boxes running SuSE or RedHat
Linux with increasing velocity.  Especially those in China, Singapur
and Brasil.  So in our customer base, Solaris and IRIX is dying out
faster than I myself as a strong Linux proposer had believed even at
the beginning of this year.  YMMV since we are only a small company
in a very special market segment.

Regards, Peter