[BRAINSTORM] shebang fixing framework

Garance A Drosehn gad at FreeBSD.org
Thu May 2 21:04:50 UTC 2013


On 4/30/13 6:38 AM, Baptiste Daroussin wrote:
> Hi all,
>
> For a while now: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/51152 we are
> looking for a framework/helpers to help patching scripts shebang so that they
> fit where the interpreters is on FreeBSD.
>
> We also want to get rid of /usr/bin/perl
> http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/170219 and such helpers would
> help

Many years ago we (at RPI) went with a different tactic for this.
We wrote intercept programs which we installed for interpreter
files such as /usr/bin/perl.  The program was a short C program
which knew how to search for the real interpreter, and would
exec that interpreter once it was found.  These intercept routines
included support for multiple versions of a given interpreter,
such that users could select which version of (say) perl that
they wanted to use.

The exact code that we used for this would need to be rewritten
for general freebsd use, because it depended on a lot of other
special "session/setup" code that we also implemented.  But I
think FreeBSD could do something along the same lines, and then
you wouldn't have to fix any references to /usr/bin/perl.

I suspect I have written some rough ideas of this on some FreeBSD
mailing list in the past, but offhand I don't remember where or
when.  It could have been a long time ago, because we've been
using this tactic on our solaris/aix/irix machines at RPI for at
least 15 years now.  (however our systems-programmer group has
been cut back so much that we haven't done any new work on it for
at least eight years)

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-ports mailing list