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