lkml.org 
[lkml]   [2002]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG?] binfmt_script: interpreted interpreter doesn't work
On Sun, 15 Sep 2002, Ingo Oeser wrote:

> Hi Pozsar,
>
> On Sun, Sep 15, 2002 at 07:15:38PM +0200, Pozsar Balazs wrote:
> > This may well not be bug, rather an intended feature, but please enlighten
> > me why the following doesn't work:
> >
> > I have two scripts:
> > /home/pozsy/a:
> > #!/bin/sh
> > echo "Hello from a!"
> >
> > /home/pozsy/b:
> > #!/home/pozsy/a
> > echo "hello from b!"
> >
> > Both of them has +x permissions.
> > But I cannot execute the /home/pozsy/b script:
> >
> > Isn't this "indirection" allowed?
>
> Right, this isn't allowed to avoid eating kernel resources
> without getting anything done.
>
> Solution is to always compile an interpreter or to write
> a wrapper in C, which is compiled and calls the perl interpreter
> with your perl script. This wrapper would be ANSI-C with really
> basic POSIX extensions and should thus be as portable as perl ;-)
>
> So you hide the indirection from the kernel this way.
>
> Of course you now define the wrapper as the interpreter for your
> perl scripts.
>
> Hope that helps.

Ok, using a C wrapper I can workaround the problem. But that is ugly,
and I do not see the point why cannot be the indirection level, say, 5.

I have also had a look at fs/exec.c and fs/binfmt_script.c and I cannot
see where the 1-level comes from. Could anyone explain?

--
pozsy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.031 / U:11.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site