Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 2013 11:57:03 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Colin Percival <cperciva@FreeBSD.org>, src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   Re: svn commit: r257602 - user/cperciva/panicmail
Message-ID:  <20131108105702.GA25448@stack.nl>
In-Reply-To: <20131107223414.GH37879@caravan.chchile.org>
References:  <201311040300.rA430jCQ066512@svn.freebsd.org> <20131107223414.GH37879@caravan.chchile.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 07, 2013 at 11:34:15PM +0100, Jeremie Le Hen wrote:
> On Mon, Nov 04, 2013 at 03:00:45AM +0000, Colin Percival wrote:
> > Author: cperciva
> > Date: Mon Nov  4 03:00:44 2013
> > New Revision: 257602
> > URL: http://svnweb.freebsd.org/changeset/base/257602

> > Log:
> >   Change
> >   	local tmpfile=`mktemp` || exit 1
> >   into
> >   	local tmpfile
> >   	tmpfile=`mktemp` || exit 1
> >   since the former is parsed as "local || exit 1" and loses the exit code
> >   from mktemp.

> >   Submitted by:	jilles

> Out of curiosity, is this brokenness of local mandated by the standard?

local is not in any standard, but this behaviour of command
substitutions has been mandated for a long time. If there is a command
word, the exit status is the exit status of that command word, not the
exit status of a command substitution. On the other hand, in the
original Bourne shell, it was possible to do things like
  set -- `getopt ab: $*`; errcode=$?

Given that it already changed once, I think changing it back would be
inappropriate and unlikely.

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131108105702.GA25448>