Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!ncar!gatech!mcnc!decvax!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: comp.unix.wizards Subject: Re: SVR3.0 vs BSD4.3 Message-ID: <7585@ncoast.UUCP> Date: 5 Apr 88 01:58:36 GMT References: <12414@brl-adm.ARPA> <4361@megaron.arizona.edu> <7499@brl-smoke.ARPA> <2423@bsu-cs.UUCP> <7514@brl-smoke.ARPA> <518@spectrix.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 39 As quoted from <518@spectrix.UUCP> by John_M@spectrix.UUCP (John Macdonald): +--------------- | In article <7514@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: | >[response to:] | >In article <2423@bsu-cs.UUCP> dhesi@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