From owner-freebsd-questions@FreeBSD.ORG Mon Nov 19 21:18:04 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 760DF518 for ; Mon, 19 Nov 2012 21:18:04 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id DAF158FC0C for ; Mon, 19 Nov 2012 21:18:02 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id qAJLIqTi083328 for freebsd-questions@freebsd.org; Mon, 19 Nov 2012 15:18:52 -0600 (CST) Date: Mon, 19 Nov 2012 15:18:52 -0600 (CST) From: Robert Bonomi Message-Id: <201211192118.qAJLIqTi083328@mail.r-bonomi.com> To: freebsd-questions@freebsd.org Subject: Re: portsnap In-Reply-To: X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 21:18:04 -0000 > From owner-freebsd-questions@freebsd.org Mon Nov 19 14:15:23 2012 > To: freebsd-questions@freebsd.org > From: jb > Subject: Re: portsnap > Date: Mon, 19 Nov 2012 20:13:45 +0000 (UTC) > > RW googlemail.com> writes: > > > > > On Mon, 19 Nov 2012 16:10:48 +0000 (UTC) jb wrote: > > > > > > You gave portsnap two commands - one succeeded and the other > > > > failed. > > Nope. I gave ONE command: 'portsnap fetch update'. FALSE TO FACT. You invoked one executable, 'portsnap', giving IT two commands, 'fetch' and 'update' as parameters. Which is *EXACTlY* the same as if you had invoked that executable twice, giving it one command (in the order above) on each invocation. The 'fetch' command succeeded. The 'update' command failed. > > > > But this looks like a flaky entry validation - it should be rejected > > > up front as invalid entry, even if it applied to the second part - > > > "update". Because the effect of processing the entire entry "fetch" > > > plus "update" is lost anyway. > > > > Not isn't, you've brought the snapshot up to date. > > Well, yes. But as I already explained, there was ONE command. You misunderstood the terminology -- you gave *TWO* commmands _to_the_ _portsnap_program_. when portsnap is given multiple commands as invocation arguments, it processes them sequentially, retuning an 'exit status' for the first command that _fails, or 'success' if none of the commands failed. > If I wanted to be satisfied with two command outcomes, even if logically > linked by sequential execution, then I would do: > # portsnap fetch; portsnap update > > There is a subtle, but important difference. Only in your expectations. > In general, if I wanted to check for command completion code, which is > quite common in UNIX CLI or scripting env, it would make a lot of > difference if a command failed half way in both cases: > 'portsnap fetch update; check-completion-code' > and 'portsnap fetch; check-completion-code; portsnap update; > check-completion-code' 'portsnap fetch update' is the EXACT equivalent of: 'portsnap fetch && portsnap update; `check-completion-code'` Your: 'portsnap fetch; check-completion-code; portsnap update; check-completion-code' is bad/incorrect scripting since it _unconditionally_ executes 'portsnap update', which you do NOT want to do if/when 'fetch' fails.