Re: Change the executing of a 0-byte file to be an error...
From: Harti Brandt (hartmut.brandt_at_dlr.de)
Date: 06/10/05
- Previous message: Garance A Drosihn: "Re: Change the executing of a 0-byte file to be an error..."
- In reply to: Garance A Drosihn: "Re: Change the executing of a 0-byte file to be an error..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 10 Jun 2005 14:00:06 +0200 (CEST) To: Garance A Drosihn <drosih@rpi.edu>
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
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Garance A Drosihn: "Re: Change the executing of a 0-byte file to be an error..."
- In reply to: Garance A Drosihn: "Re: Change the executing of a 0-byte file to be an error..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|