lkml.org 
[lkml]   [1997]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: "What is the !@#$ pathname of Perl on *this* machine?"
worley@ariadne.com (Dale R. Worley) writes:

> From: Will French <wfrench@interport.net>

> Why do you assume that "people never write relative paths into
> '#!' lines"? I just tried it, and it works quite well; perhaps
> there is someone somewhere who depends on it. I suggest having
> a special prefix, such as "#!?perl", to tell your code to look
> up perl in the list.

>Well, I've never seen nor heard of anyone writing relative paths.

I do. Using relative paths is quite useful for starting an explicit
version of an interpreter not installed in the system. Not having
seen or heard of anyone doing something does not mean that doing
something does not exist.

>But I do like the idea of having a special prefix character. What
>characters do you think would be good?

Try something like #! /bin/pathexec scriptname args

no pathexec does not yet exist, it remains to be written:
- find the location of argv[1]
- exec (location, rest-of-argv);


>Of course, there are no
>characters which are invalid for pathname (other than NUL), so we
>still can't avoid messing up something that someone might be doing
>somewhere.

By using a user level solution you avoid kernel bloat. By using a user
level solution you also avioid messing up with something that someone
might be doing somewhere.

A more general solution (because it is portable to platforms without
the #! hack) is to coerce application programmers into using some tool
that can find interpreters and fix #! lines when compiling or
installing an application. (for example a combination of gnu autoconf
and sed or a perl script ...)

By the way, different users on a machine have different needs for
their scripts, which would be hard for the kernel to handle. An user
level solution could open a user-specific configuration file and
voila, instant magick.

Froh

--
Frohwalt Egerer froh@iconsult.com

Games are the only things that keep my DOS partition
from becoming /usr2. -- Jeff Epler


\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.440 / U:0.128 seconds]
©2003-2011 Jasper Spaans. Advertise on this site