From owner-freebsd-standards@FreeBSD.ORG Fri Jun 10 11:11:05 2005 Return-Path: X-Original-To: freebsd-standards@FreeBSD.ORG Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6788E16A41C; Fri, 10 Jun 2005 11:11:05 +0000 (GMT) (envelope-from setantae@submonkey.net) Received: from shrike.submonkey.net (cpc4-cdif3-6-1-cust116.cdif.cable.ntl.com [82.23.41.116]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF69943D1F; Fri, 10 Jun 2005 11:11:04 +0000 (GMT) (envelope-from setantae@submonkey.net) Received: from setantae by shrike.submonkey.net with local (Exim 4.51 (FreeBSD)) id 1DghPj-0001zo-Rg; Fri, 10 Jun 2005 12:11:03 +0100 Date: Fri, 10 Jun 2005 12:11:03 +0100 From: Ceri Davies To: Garance A Drosihn Message-ID: <20050610111103.GE14221@submonkey.net> Mail-Followup-To: Ceri Davies , Garance A Drosihn , freebsd-arch@FreeBSD.ORG, freebsd-standards@FreeBSD.ORG References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YkNwngLRNOQA9swf" Content-Disposition: inline In-Reply-To: X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.9i Sender: Ceri Davies Cc: freebsd-standards@FreeBSD.ORG, freebsd-arch@FreeBSD.ORG Subject: Re: Change the executing of a 0-byte file to be an error... X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2005 11:11:05 -0000 --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--