Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!ames!amdahl!pyramid!uccba!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: comp.unix.questions Subject: bexec Message-ID: <2636@ncoast.UUCP> Date: Fri, 12-Jun-87 22:24:05 EDT Article-I.D.: ncoast.2636 Posted: Fri Jun 12 22:24:05 1987 Date-Received: Sat, 20-Jun-87 18:48:18 EDT References: <2625@ncoast.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.unix.questions Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 52 Since there's been some discussion on the net about the situation that "bexec" was designed to solve, I feel justified in posting this to the whole world instead of mailing it. As quoted from <2625@ncoast.UUCP> by robertd@ncoast.UUCP (Rob DeMarco): +--------------- | Can some one tell me in a clear, consise way how bexec differs from exec? +--------------- The program bexec has very little relation to the exec system call or the exec shell command which uses the exec system call. It is intended to fix a "feature" of csh which is now widely considered a bug; it also adds features to older versions of csh. Some (all?) versions of csh have the ability to pass non-a.out files (shell scripts or other non-machine-code files) to a user-specified program; the feature is enabled by aliasing "shell" to the full pathname of the program. All versions of csh will, if the "alias shell" feature is not used, check the first character of a script for being "#" and, if it is, run it as a csh script; otherwise running it as a sh script. The original version of bexec simply forced all scripts to be run by sh. Soon after I wrote it, I changed it to check the first line for #! and do the appropriate thing. It didn't do setuid, but it tried to do the rest. (Robert, this is the version ncoast runs.) Unfortunately, this version didn't do it right. (It passed the script as standard input, not as an argument.) So, I wrote another version. This one handles #! correctly; it also checks to see if the first block of the file contains any non-ASCII characters (octal \200-\377) and if so, sets the RUNPATH environment variable to the program's full pathname and invokes RM/COBOL (runcobol) on it; the effect being that RM/COBOL executables may be run directly. I have no idea if 4.[123]BSD still supports "alias shell", for the run /bin/sh and runcobol features (the kernel handles #! so you get the kernel one rather than the bexec one); but if it does, BSDers may be interested in it. (Of course, it might be difficult to find RM/COBOL for BSD....) It is, however, almost a must for sites running SysIII or SysV which has an add-on "old" csh, since it adds all of these features. If anyone's interested, send mail and I'll post it. ++Brandon -- Copyright (C) 1987 Brandon S. Allbery. Redistribution permitted only if the redistributor permits further redistribution. (Stargate take heed!) ---- Moderator for comp.sources.misc and comp.binaries.ibm.pc ---- Brandon S. Allbery {decvax,cbosgd}!cwruecmp!ncoast!allbery aXcess Company {ames,mit-eddie,talcott}!necntc!ncoast!allbery 6615 Center St. #A1-105 necntc!ncoast!allbery@harvard.HARVARD.EDU Mentor, OH 44060-4101 +01 216 974 9210 (also eddie.MIT.EDU)