From owner-freebsd-arch@FreeBSD.ORG Tue May 24 10:46:36 2005 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8DF316A41F for ; Tue, 24 May 2005 10:46:36 +0000 (GMT) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-1.dlr.de (smtp-1.dlr.de [195.37.61.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5480D43D1F for ; Tue, 24 May 2005 10:46:35 +0000 (GMT) (envelope-from Hartmut.Brandt@dlr.de) Received: from beagle.kn.op.dlr.de ([129.247.173.6]) by smtp-1.dlr.de over TLS secured channel with Microsoft SMTPSVC(6.0.3790.211); Tue, 24 May 2005 12:46:33 +0200 Date: Tue, 24 May 2005 12:46:33 +0200 (CEST) From: Harti Brandt X-X-Sender: brandt_h@beagle.kn.op.dlr.de To: Peter Jeremy In-Reply-To: <20050524093238.GC12640@cirb503493.alcatel.com.au> Message-ID: <20050524114748.O50725@beagle.kn.op.dlr.de> References: <20050523153118.C28521@beagle.kn.op.dlr.de> <42929680.3000309@samsco.org> <20050524093238.GC12640@cirb503493.alcatel.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 24 May 2005 10:46:33.0944 (UTC) FILETIME=[DA32D580:01C5604D] Cc: arch@freebsd.org Subject: Re: Handling of shell builtins in make(1) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Harti Brandt List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2005 10:46:37 -0000 On Tue, 24 May 2005, Peter Jeremy wrote: PJ>On Mon, 2005-May-23 20:50:40 -0600, Scott Long wrote: PJ>>Harti Brandt wrote: PJ>>>The result of this is that for one and the same command you can get PJ>>>different behaviour whether you execute it via make(1) or via sh -c '...'. PJ> PJ>Not to mention the effect of IFS. Does POSIX provide any helpful PJ>suggestions on how to efficiently implement the behaviour they specify? POSIX has no .SHELL target - that's pmake's invention. IFS is no problem because in order to specify a different IFS you need to have at least a '=' on the command line. This is a meta character so the command will be executed by the shell. Generally POSIX says that make should execute command lines as if given to system(). System() in turn says that it should behave as if it fork()ed and execl()ed "sh -c ...". The as-if here seems to allow for our optimisation. PJ> PJ>>4. Separate /bin/sh into a front end and back end (libsh) and include PJ>>libsh into make. PJ> PJ>And this still won't help people who use .SHELL (or similar) to pick PJ>a different shell. PJ> PJ>5) Add a "POSIX_ME_HARDER" option that just invokes the shell on every PJ> command. In the absence of this option, make(1) is free to directly PJ> exec the command if it's simple enough. PJ> PJ>6) Add two new magic line markers (to supplement '@', '+' and '-') to PJ> require the line be executed using the shell or exec'd directly, PJ> superceding the buildin rules. You can alway make to execute the shell by putting a meta-character on the command line or by specifying and empty builtin list or an empty meta character list to .SHELL. But what should we do as default? harti