From owner-svn-src-all@FreeBSD.ORG Sun Oct 12 13:12:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0DC38EA; Sun, 12 Oct 2014 13:12:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92F2C7B2; Sun, 12 Oct 2014 13:12:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9CDC7co044634; Sun, 12 Oct 2014 13:12:07 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9CDC6V9044630; Sun, 12 Oct 2014 13:12:06 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410121312.s9CDC6V9044630@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 12 Oct 2014 13:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272983 - in head/bin/sh: . tests/builtins 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.18-1 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: Sun, 12 Oct 2014 13:12:07 -0000 Author: jilles Date: Sun Oct 12 13:12:06 2014 New Revision: 272983 URL: https://svnweb.freebsd.org/changeset/base/272983 Log: sh: Fix break/continue/return in multiline eval. Example: eval $'return\necho bad' Added: head/bin/sh/tests/builtins/eval7.0 (contents, props changed) head/bin/sh/tests/builtins/eval8.7 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/tests/builtins/Makefile Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Oct 12 11:22:25 2014 (r272982) +++ head/bin/sh/eval.c Sun Oct 12 13:12:06 2014 (r272983) @@ -168,6 +168,8 @@ evalstring(char *s, int flags) else evaltree(n, flags); any = 1; + if (evalskip) + break; } popstackmark(&smark); setstackmark(&smark); Modified: head/bin/sh/tests/builtins/Makefile ============================================================================== --- head/bin/sh/tests/builtins/Makefile Sun Oct 12 11:22:25 2014 (r272982) +++ head/bin/sh/tests/builtins/Makefile Sun Oct 12 13:12:06 2014 (r272983) @@ -72,6 +72,8 @@ FILES+= eval3.0 FILES+= eval4.0 FILES+= eval5.0 FILES+= eval6.0 +FILES+= eval7.0 +FILES+= eval8.7 FILES+= exec1.0 FILES+= exec2.0 FILES+= exit1.0 Added: head/bin/sh/tests/builtins/eval7.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/eval7.0 Sun Oct 12 13:12:06 2014 (r272983) @@ -0,0 +1,9 @@ +# $FreeBSD$ +# Assumes that break can break out of a loop outside eval. + +while :; do + eval "break +echo bad1" + echo bad2 + exit 3 +done Added: head/bin/sh/tests/builtins/eval8.7 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/eval8.7 Sun Oct 12 13:12:06 2014 (r272983) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +f() { + eval "return 7 +echo bad2" +} +f