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: Warner Losh: "Re: Change the executing of a 0-byte file to be an error..."
    Date: Fri, 10 Jun 2005 01:33:02 -0400
    To: freebsd-arch@FreeBSD.ORG
    
    

    A few months ago, I had a system panic happen right in the middle of
    a 'installworld'. Right now I don't care about the panic itself
    (IIRC, it was a hardware problem), but there was one unexpected
    side-effect which caused me more trouble than the original panic.
    And all that trouble boils down to the following:

        If a file is empty and executable, that empty file can be
        executed without generating any error.

    The panic caused a few files in /usr/bin to end up as zero-byte
    executable files, but I didn't realize that. I ended up doing
    another buildworld, I think it was, and ended up digging myself
    into a deeper and deeper hole. The problem included things like
    makefile rules calling:

          somecmd | sort -blah | domore

    where the 'sort' command had turned into one of those zero-byte
    executable files. The basic result was that the more I tried to
    rebuild parts of the world, the more screwed up the system became.
    By the time I was done, I had to do a clean install from CD-ROM
    to get it back to working order.

    Can anyone think of a real-world problem that would come up if the
    system was changed so that executing a 0-byte file would cause an
    error? I read through a few likely pages in SUSv3, and it looked
    like the behavior for executing an 0-byte file is not explicitly
    defined. Of course, it might be that I was simply looking in the
    wrong part of the standard.

    It does seem like empty files are also executed without error on a
    few other OS's I tried, but I don't understand why that behavior
    would be desirable.

    -- 
    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: Warner Losh: "Re: Change the executing of a 0-byte file to be an error..."