SVR3.0 vs BSD4.3

Brandon Allbery allbery at ncoast.UUCP
Tue Apr 5 11:58:36 AEST 1988


As quoted from <518 at spectrix.UUCP> by John_M at spectrix.UUCP (John Macdonald):
+---------------
| In article <7514 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
| >[response to:]
| >In article <2423 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
| >>[lots of detail differences where BSD4.3 is "preferred" than SVR3.0]
| > ...
| >[excellent response to most points]
| >
| >>   support for multiple command interpreters with #! as first line of script
| >
| >This is totally unnecessary; if all scripts are executed by a Bourne
| >shell, it is easy to simulate the #! feature, in fact to generalize
| >on it.  Nevertheless I think AT&T may be adding this kludge to the
| >kernel exec code in a future release, alas.
| 
| I think you are going a bit too far here - it is easy to get sh to invoke
| another interpreter on a script, but not allowing the full capability
| that #! provides (unless I'm missing some clever sh trick).  In particular,
| I don't think you can cause the command "file args" to effectively invoke
| "interp [path/]file args" and keep the name of the file available to
| the interpreter (for $0 type use).  If $0 is not needed, of course, the sh
+---------------

Go look in the comp.sources.misc archives, and pull out issue 8706/2, "bexec".
This can do everything you ask for including retaining $0.  And if it can be
done from outside a shell (admittedly, by a hack) then it can be done more
easily from inside the shell.  execv?() allows argv[0] to be different from
the path for a reason.

A copy of /bin/sh modified for this would handle everything on "vanilla"
System V systems except programs using something other than exec?p(); which
programs ought be stamped out, in my opinion.  To avoid changing the shells,
it should be changed in exec?p(), and the shells should use it (dunno if sh
does, but I'm certain that csh doesn't).  A user-mode solution is better
than a kernel hack.  (All you lose is setuid shell scripts, which are an
abomination anyway.)
-- 
	      Brandon S. Allbery, moderator of comp.sources.misc
       {well!hoptoad,uunet!hnsurg3,cbosgd,sun!mandrill}!ncoast!allbery



More information about the Comp.unix.wizards mailing list