mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Veltzer <mark@veltzer.org>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [BUG?] binfmt_script: interpreted interpreter doesn't work
Date: Mon, 16 Sep 2002 00:18:35 +0300	[thread overview]
Message-ID: <200209152118.g8FLIeL26371@www.veltzer.org> (raw)
In-Reply-To: <20020915220651.C642@nightmaster.csn.tu-chemnitz.de>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 15 September 2002 23:06, Ingo Oeser wrote:
> Hi Pozsar,
>

> Right, this isn't allowed to avoid eating kernel resources
> without getting anything done.

You mean like writing a program to calculate PI to the 1,000,000th digit ?
The kernel is not supposed to dictate what is done with it. If the user wants 
to link 10,000 such scripts in a chain then let him. I suspect that that 
isn't the problem. The problem is that before the launch of the program the 
time is not counted as time spent on that specific user and so this could be 
used as loop hole to drain resources from other users. If this is the case 
then this time should be accounted for (I'm not sure about this though and if 
the time is accounted for then I don't see any reason to disable the chains 
except avoiding cycles which needs some coding). 

>
> 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 ;-)

There is actually already a program that one can use. It's /usr/bin/env and 
is part of the sh-utils package from GNU. I always use and instead of writing 
something like:

#!/usr/bin/perl
.....

I write:

#!/usr/bin/env perl
.....

This way the users preferred perl is used and I'm reducing all my arbitrary 
assumptions about locations of executables to one assumption about the 
location of /usr/bin/env (one hardcoded fact is better than many cause it's 
easier to fix if need be).

You can use env to solve your problem. In your scripts replace all shbang 
lines. /usr/bin/env is, ofcourse, a binary executable.

Name: Mark Veltzer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9hPkuxlxDIcceXTgRAgB+AKCJ8JtVKrpNfnaTy7/kQASSEtxsdACgyPl/
czeMVYsD5Qp+da49hyoPpFc=
=Ux8a
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2002-09-15 21:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-15 17:15 Pozsar Balazs
2002-09-15 19:05 ` Gilad Ben-Yossef
2002-09-15 19:14   ` Pozsar Balazs
2002-09-15 20:06 ` Ingo Oeser
2002-09-15 21:04   ` Pozsar Balazs
2002-09-15 21:18   ` Mark Veltzer [this message]
2002-09-15 21:19   ` jbradford
     [not found] <200209152055.05322.hpj@urpla.net>
2002-09-15 19:13 ` Pozsar Balazs
2002-09-15 19:34   ` Willy Tarreau
2002-09-15 21:00     ` Pozsar Balazs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200209152118.g8FLIeL26371@www.veltzer.org \
    --to=mark@veltzer.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®