From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 21:33:50 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CDC4106564A; Sat, 13 Aug 2011 21:33:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61E708FC0C; Sat, 13 Aug 2011 21:33:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DLXoT4033863; Sat, 13 Aug 2011 21:33:50 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DLXo3m033860; Sat, 13 Aug 2011 21:33:50 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201108132133.p7DLXo3m033860@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 13 Aug 2011 21:33:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224854 - in stable/8: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 21:33:50 -0000 Author: jilles Date: Sat Aug 13 21:33:50 2011 New Revision: 224854 URL: http://svn.freebsd.org/changeset/base/224854 Log: MFC r222716: sh: Fix $? in heredocs on simple commands. The patch is slightly different because redirected compound commands are handled differently in stable/8 (no separate function, redirection errors are fatal). PR: bin/41410 Added: stable/8/tools/regression/bin/sh/expansion/heredoc2.0 - copied unchanged from r222716, head/tools/regression/bin/sh/expansion/heredoc2.0 Modified: stable/8/bin/sh/eval.c Directory Properties: stable/8/bin/sh/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/bin/sh/eval.c ============================================================================== --- stable/8/bin/sh/eval.c Sat Aug 13 17:29:37 2011 (r224853) +++ stable/8/bin/sh/eval.c Sat Aug 13 21:33:50 2011 (r224854) @@ -221,6 +221,7 @@ evaltree(union node *n, int flags) evaltree(n->nbinary.ch2, flags); break; case NREDIR: + oexitstatus = exitstatus; expredir(n->nredir.redirect); redirect(n->nredir.redirect, REDIR_PUSH); evaltree(n->nredir.n, flags); @@ -400,6 +401,7 @@ evalsubshell(union node *n, int flags) struct job *jp; int backgnd = (n->type == NBACKGND); + oexitstatus = exitstatus; expredir(n->nredir.redirect); if ((!backgnd && flags & EV_EXIT && !have_traps()) || forkshell(jp = makejob(n, 1), n, backgnd) == 0) { @@ -428,7 +430,6 @@ expredir(union node *n) for (redir = n ; redir ; redir = redir->nfile.next) { struct arglist fn; fn.lastp = &fn.list; - oexitstatus = exitstatus; switch (redir->type) { case NFROM: case NTO: Copied: stable/8/tools/regression/bin/sh/expansion/heredoc2.0 (from r222716, head/tools/regression/bin/sh/expansion/heredoc2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/heredoc2.0 Sat Aug 13 21:33:50 2011 (r224854, copy of r222716, head/tools/regression/bin/sh/expansion/heredoc2.0) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +f() { return $1; } + +[ `f 42; cat <