Change the executing of a 0-byte file to be an error...
Garance A Drosihn
drosih at rpi.edu
Fri Jun 10 11:56:24 GMT 2005
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:
>$ PS1='sh$ '
>sh$ touch empty ; chmod +x empty
>sh$ echo $?
>sh$ PS1='zsh$ ' zsh
>zsh: exec format error: ./empty
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 at gilead.netel.rpi.edu
Senior Systems Programmer or gad at freebsd.org
Rensselaer Polytechnic Institute or drosih at rpi.edu
More information about the freebsd-standards