Date: Fri, 10 Jun 2005 12:11:03 +0100 From: Ceri Davies <ceri@submonkey.net> To: Garance A Drosihn <drosih@rpi.edu> Cc: freebsd-standards@FreeBSD.ORG, freebsd-arch@FreeBSD.ORG Subject: Re: Change the executing of a 0-byte file to be an error... Message-ID: <20050610111103.GE14221@submonkey.net> In-Reply-To: <p06210260beced2897aba@[128.113.24.47]> References: <p06210260beced2897aba@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
--YkNwngLRNOQA9swf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 10, 2005 at 01:33:02AM -0400, Garance A Drosihn wrote: > 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: >=20 > If a file is empty and executable, that empty file can be > executed without generating any error. >=20 > 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: >=20 > somecmd | sort -blah | domore >=20 > 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. >=20 > 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. >=20 > 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. 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=3D'sh$ ' sh$ touch empty ; chmod +x empty sh$ ./empty sh$ echo $? 0 sh$ PS1=3D'zsh$ ' zsh zsh$ zsh zsh$ ./empty zsh: exec format error: ./empty zsh$=20 Ceri --=20 Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. -- Einstein (attrib.) --YkNwngLRNOQA9swf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCqXVHocfcwTS3JF8RAip2AJ9cIIilTOv8Z1rb8pUsTL1MZu3l3QCgkNgy ASHMulCVdnArBtAv05geFOk= =memd -----END PGP SIGNATURE----- --YkNwngLRNOQA9swf--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050610111103.GE14221>