Change the executing of a 0-byte file to be an error...
Garance A Drosihn
drosih at rpi.edu
Fri Jun 10 05:33:07 GMT 2005
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 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-arch
mailing list