Re: Change the executing of a 0-byte file to be an error...

From: Garance A Drosihn (drosih_at_rpi.edu)
Date: 06/10/05

  • Next message: Harti Brandt: "Re: Change the executing of a 0-byte file to be an error..."
    Date: Fri, 10 Jun 2005 07:56:19 -0400
    To: Ceri Davies <ceri@submonkey.net>
    
    

    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
    _______________________________________________
    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"
    

  • Next message: Harti Brandt: "Re: Change the executing of a 0-byte file to be an error..."

    Relevant Pages