Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA6596 ; Mon, 11 Jan 93 08:06:58 EST Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usc!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!mcsun!sun4nl!tuegate.tue.nl!svin09!wzv!gvr.win.tue.nl!guido From: guido@gvr.win.tue.nl (Guido van Rooij) Newsgroups: comp.unix.bsd Subject: Re: kern_execve.c (patch) Keywords: patch kern_execve.c #! Message-ID: <4348@wzv.win.tue.nl> Date: 13 Jan 93 17:03:06 GMT References: <1isforINNbb7@urmel.informatik.rwth-aachen.de> <4346@wzv.win.tue.nl> Sender: news@wzv.win.tue.nl Lines: 42 guido@gvr.win.tue.nl (Guido van Rooij) writes: >kuku@acds.physik.rwth-aachen.de (Christoph Kukulies) writes: >>There is a patch for kern_execve.c (PATCH00024+PATCH00025) in the patchkit >>which fixes the missing #!/bin/sh feature to execute shell scripts or whatever. >Indeed this patch was present for a long time. The patch posted here has a >big bug: >If multiple arguments are given, they are all passed as one single >argument. >As an example consider the following script: >#!/bin/cat foo bar >What you want is both the files foo and bar printed. The posted patch >however makes cat to try to print "foo bar". Someone pointed to me that this "bug" is present both in SunOs 4.? and Ultrix so now I am not so sure anymore about if this is a bug. Here is a portion of execve's manpage: An interpreter file begins with a line of the form: #! interpreter [arg] When an interpreter file is execve()'d, the system execve()'s the speci- fied interpreter. If the optional arg is specified, it becomes the first argument to the interpreter, and the name of the originally execve()'d file becomes the second argument; otherwise, the name of the originally execve()'d file becomes the first argument. The original arguments are shifted over to become the subsequent arguments. The zeroth argument, normally the name of the execve()'d file, is left unchanged. So it says only one argument is allowed. This makes my patch obsolete, and so I canceled it. -Guido