From owner-svn-src-all@FreeBSD.ORG Mon Jan 14 12:20:56 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5A812907; Mon, 14 Jan 2013 12:20:56 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4B653ED0; Mon, 14 Jan 2013 12:20:56 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0ECKuqd071484; Mon, 14 Jan 2013 12:20:56 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0ECKtY4071480; Mon, 14 Jan 2013 12:20:55 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201301141220.r0ECKtY4071480@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 14 Jan 2013 12:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245422 - in head: bin/sh tools/regression/bin/sh/expansion X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jan 2013 12:20:56 -0000 Author: jilles Date: Mon Jan 14 12:20:55 2013 New Revision: 245422 URL: http://svnweb.freebsd.org/changeset/base/245422 Log: sh: Pass $? to command substitution containing compound/multiple commands. Example: false; echo $(echo $?; :) Added: head/tools/regression/bin/sh/expansion/cmdsubst17.0 (contents, props changed) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Mon Jan 14 12:12:56 2013 (r245421) +++ head/bin/sh/eval.c Mon Jan 14 12:20:55 2013 (r245422) @@ -624,8 +624,8 @@ evalbackcmd(union node *n, struct backcm exitstatus = 0; goto out; } + exitstatus = oexitstatus; if (is_valid_fast_cmdsubst(n)) { - exitstatus = oexitstatus; savelocalvars = localvars; localvars = NULL; forcelocal++; @@ -649,7 +649,6 @@ evalbackcmd(union node *n, struct backcm poplocalvars(); localvars = savelocalvars; } else { - exitstatus = 0; if (pipe(pip) < 0) error("Pipe call failed: %s", strerror(errno)); jp = makejob(n, 1); Added: head/tools/regression/bin/sh/expansion/cmdsubst17.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/cmdsubst17.0 Mon Jan 14 12:20:55 2013 (r245422) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +f() { return 3; } +f +[ `echo $?; :` = 3 ]