develooper Front page | perl.perl5.porters | Postings from January 2012

Re: Shebang line parsing mystery

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
January 17, 2012 05:24
Subject:
Re: Shebang line parsing mystery
Message ID:
alpine.DEB.2.00.1201170815320.22108@fractal.phys.lafayette.edu
On Mon, 16 Jan 2012, Rafael Garcia-Suarez wrote:

> I know that perlrun states this :
> 
> If the C<#!> line does not contain the word "perl", the program named after
> the C<#!> is executed instead of the Perl interpreter.  This is slightly
> bizarre, but it helps people on machines that don't do C<#!>, because they
> can tell a program that their SHELL is F</usr/bin/perl>, and Perl will then
> dispatch the program to the correct interpreter for them.
> 
> That feature can be questioned, esp. for Unix-like platforms, but it's
> not my point there; if I look at the code that execs the program
> specified on the #! line, I see that it also looks for the characters
> "indir" there. And indeed, that disables the exec :

> According to git-blame, this has been this way forever, and it's not
> documented. Any idea why this could have been included there by Larry
> ?

If I recall correctly, 'indir' was a program designed to indirectly 
execute other programs.  My recollection is that it was supposed to be 
particularly useful in setuid situations where the OS didn't natively 
provide you much help, and/or perhaps in situations where the OS kernel 
limited you to 32 character command lines.

> Personally I wouldn't object to the removal of this exec feature. But
> at the very least shouldn't we document that "indir" thing ?

I don't think indir is actively maintained, and we don't recommend
doing setuid scripts this way anymore either, so removing the 'indir' 
special case is probably appropriate.

-- 
    Andy Dougherty		doughera@lafayette.edu

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About