From owner-freebsd-arch@FreeBSD.ORG Tue May 24 12:19:18 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 3E30716A41C for ; Tue, 24 May 2005 12:19:18 +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 A4B6243D1F for ; Tue, 24 May 2005 12:19:17 +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 14:19:15 +0200 Date: Tue, 24 May 2005 14:19:17 +0200 (CEST) From: Harti Brandt X-X-Sender: brandt_h@beagle.kn.op.dlr.de To: Sergey Babkin In-Reply-To: <21970515.1116936525835.JavaMail.root@vms076.mailsrvcs.net> Message-ID: <20050524141425.A50725@beagle.kn.op.dlr.de> References: <21970515.1116936525835.JavaMail.root@vms076.mailsrvcs.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 24 May 2005 12:19:15.0834 (UTC) FILETIME=[CD57E5A0:01C5605A] Cc: arch@freebsd.org Subject: Re: 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 12:19:18 -0000 On Tue, 24 May 2005, Sergey Babkin wrote: SB>>From: Harti Brandt SB> SB>>On Mon, 23 May 2005, Scott Long wrote: SB>> SB> SB>>SL>> Opinions? SB>>SL>> SB>>SL>> harti SB>>SL> SB>>SL>4. Separate /bin/sh into a front end and back end (libsh) and include libsh SB>>SL>into make. SB>>SL> SB>>SL>(running and hiding as I hit the 'send' key) SB>> SB>>Would there be other uses for this? SB> SB>Yes, I think it could be useful for many programs. Hmm. What program is executing shell lines? SB>Or one more option: add a flag to shell that SB>will make it exit after any command returning non-0 SB>status (at the ";" point, as opposed to "&&", SB>"||" and such). Then make could just pass all SB>the commands to the shell in one go. And it would There is the -e flag which does exactly this. Well, the description in the Posix page is a little bit convoluted, but basically it exits when a program whose exit status is not expclicitely tested exits with a non-zero status (this is not entirely correct, but almost). And currently we actually use sh -ec to execute commands. The problem with this is, that Posix wants sh -c. No -e! I think NetBSD has changed this (and there is a PR with a patch), but I'm somewhat reluctant to do it, because it may break things in unexpected ways. My current plan is to make the default -e normally and without -e in Posix mode. SB>be very useful for all kinds of sysadmin scripts SB>as well where explicitly checking for the results SB>of every command is a pain. Even with make it SB>would be a big improvement, since in the current SB>format a command failing inside a "for" loop SB>won't cause make to stop unless explicitly programmed SB>so, like: SB> SB>target: dependencies SB> for ... ;\ SB> do \ SB> cmd || exit 1; \ SB> done This is the canonical way to write this. Our make, however doesn't need it. harti