Date: Fri, 10 Jun 2005 14:00:06 +0200 (CEST) From: Harti Brandt <hartmut.brandt@dlr.de> To: Garance A Drosihn <drosih@rpi.edu> Cc: Ceri Davies <ceri@submonkey.net>, freebsd-standards@FreeBSD.ORG, freebsd-arch@FreeBSD.ORG Subject: Re: Change the executing of a 0-byte file to be an error... Message-ID: <20050610135808.J615@beagle.kn.op.dlr.de> In-Reply-To: <p06210261becf2c5486a5@[128.113.24.47]> References: <p06210260beced2897aba@[128.113.24.47]> <20050610111103.GE14221@submonkey.net> <p06210261becf2c5486a5@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 10 Jun 2005, Garance A Drosihn wrote: GAD>At 12:11 PM +0100 6/10/05, Ceri Davies wrote: GAD>> On Fri, Jun 10, 2005, Garance A Drosihn wrote: GAD>> > GAD>> > If a file is empty and executable, that empty file can be GAD>> > executed without generating any error. GAD>> GAD>> Are you sure? It seems to be a function of the shell more than GAD>> anything; the transcript below does exactly the same on both GAD>> FreeBSD 4-STABLE and Solaris 8: GAD>> GAD>> $ sh GAD>> $ PS1='sh$ ' GAD>> sh$ touch empty ; chmod +x empty GAD>> sh$ ./empty GAD>> sh$ echo $? GAD>> 0 GAD>> sh$ PS1='zsh$ ' zsh GAD>> zsh$ zsh GAD>> zsh$ ./empty GAD>> zsh: exec format error: ./empty GAD>> zsh$ GAD> GAD>Well, zsh can certainly add whatever processing it likes, but my main GAD>interest is what routines like 'exec()' will do with the file. In GAD>particular, I'm concerned with what happens when either `make' or `sh' GAD>execute some 0-byte file, because those are commands which will be GAD>doing the most command-executing in the process of `make buildworld'. GAD> GAD>I'll admit I did not notice that zsh made that check, as I only checked GAD>with `sh', `bash', and (inadvertently) `make'. It might be that the GAD>kernel is already doing the right thing, and what I actually need to GAD>change is `sh' and `make' instead of something in the kernel. I'm GAD>certainly willing to figure out what needs to be changed, but I GAD>thought I should first see if there are any reasons that I should not GAD>make such a change in the first place. make either uses a shell to execute a command or it uses execl() (depending whether you're in -j or -B mode and whether the line contains shell metacharacters or builtins), so when execl() does the right thing and the shell too, there is nothing to change in make. harti
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050610135808.J615>