Subject: Re: #!/usr/pkg/bin/python doesn't work with pkg_alternatives?
To: Julio M. Merino Vidal <jmmv@menta.net>
From: Pavel Cahyna <pavel.cahyna@st.cuni.cz>
List: tech-pkg
Date: 02/01/2005 13:50:10
On Tue, 01 Feb 2005 10:29:02 +0100, Julio M. Merino Vidal wrote:

> On Mon, Jan 31, 2005 at 10:42:28PM -0500, Ian D. Leroux wrote:
>> The subject line says it all: since the pkg_alternatives wrapper script
>> is itself a #!/bin/sh script, and since execve(2) only goes through one
>> such indirection, python scripts starting with #!/usr/pkg/bin/python get
>> treated as shell scripts, with predictably erratic consequences.  So is
>> this usage deprecated or is there an accepted solution?  The package
>> lang/python (now defunct) didn't have this problem because it used a
>> symlink instead of a wrapper script.
> 
> Weird... what's the rationale behind this?  I mean, why is the python script
> treated as a shell script at last?

execve(2) on Gentoo Linux says:
DESCRIPTION
       execve() executes the program pointed to by filename.  filename must be
       either  a  binary  executable,  or a script starting with a line of the
       form "#! interpreter [arg]".  In the latter case, the interpreter  must
       be  a  valid  pathname  for an executable which is not itself a script,
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       which will be invoked as interpreter [arg] filename.

possibly there is such limitation for other systems too.

Bye	Pavel