From owner-freebsd-standards@FreeBSD.ORG Fri Jun 10 11:56:24 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 54C8816A44B; Fri, 10 Jun 2005 11:56:23 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id E699343D49; Fri, 10 Jun 2005 11:56:22 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j5ABuKL7010070; Fri, 10 Jun 2005 07:56:21 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <20050610111103.GE14221@submonkey.net> References: <20050610111103.GE14221@submonkey.net> Date: Fri, 10 Jun 2005 07:56:19 -0400 To: Ceri Davies From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.4 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:56:24 -0000 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