From owner-svn-src-head@FreeBSD.ORG Mon Aug 23 07:50:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE4D81065674; Mon, 23 Aug 2010 07:50:00 +0000 (UTC) (envelope-from prvs=1844a38e31=brian@FreeBSD.org) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by mx1.freebsd.org (Postfix) with ESMTP id 529F28FC17; Mon, 23 Aug 2010 07:50:00 +0000 (UTC) Received: from pd5ml3no-ssvc.prod.shaw.ca ([10.0.153.148]) by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 23 Aug 2010 01:34:59 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=EPI+Anp5axUU12/DJ58YCKzU/28JrKwJBM9MxN4j1qY= c=1 sm=1 a=VXq8tsqEoNMA:10 a=VphdPIyG4kEA:10 a=MJPcHhXccCG8eBs0us8XwA==:17 a=6I5d2MoRAAAA:8 a=MMwg4So0AAAA:8 a=TJgWdOKpczqAMaWz67QA:9 a=OYAXRMB_6eCn7ADHmecA:7 a=w3vOS1xaNfVGzeS_8aEVBIZBe74A:4 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=WJ3hkfHDukgA:10 a=7NE1Py9lpwSuLBJfC_UA:9 a=_3Kyx6-qKaylvj2gxvohvC9KemQA:4 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO store.lan.Awfulhak.org) ([70.79.162.198]) by pd5ml3no-dmz.prod.shaw.ca with ESMTP; 23 Aug 2010 01:34:59 -0600 Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id A6907C433AC_C722445B; Mon, 23 Aug 2010 07:33:25 +0000 (GMT) Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1]) by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id 5EFB8C46121_C722442F; Mon, 23 Aug 2010 07:33:22 +0000 (GMT) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.14.4/8.14.4) with ESMTP id o7N7XMx6077065; Mon, 23 Aug 2010 00:33:22 -0700 (PDT) (envelope-from brian@FreeBSD.org) Date: Mon, 23 Aug 2010 00:33:14 -0700 From: Brian Somers To: Jilles Tjoelker Message-ID: <20100823003314.57d41b94@dev.lan.Awfulhak.org> In-Reply-To: <201008221104.o7MB4Ung001538@svn.freebsd.org> References: <201008221104.o7MB4Ung001538@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/uBHsmDpijb2Gjg4/4iP+Egi"; protocol="application/pgp-signature" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211609 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2010 07:50:01 -0000 --Sig_/uBHsmDpijb2Gjg4/4iP+Egi Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 22 Aug 2010 11:04:30 +0000 (UTC) Jilles Tjoelker wrote: > Author: jilles > Date: Sun Aug 22 11:04:30 2010 > New Revision: 211609 > URL: http://svn.freebsd.org/changeset/base/211609 >=20 > Log: > sh: Add a test for breaking from a loop outside the current function. > =20 > It is unwise to rely on this but I'd like to know if this would break. >=20 > Added: > head/tools/regression/bin/sh/builtins/break3.0 (contents, props chang= ed) >=20 > Added: head/tools/regression/bin/sh/builtins/break3.0 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/tools/regression/bin/sh/builtins/break3.0 Sun Aug 22 11:04:30 20= 10 (r211609) > @@ -0,0 +1,15 @@ > +# $FreeBSD$ > + > +# We accept this and people might rely on it. > +# However, various other shells do not accept it. > + > +f() { > + break > + echo bad1 > +} > + > +while :; do > + f > + echo bad2 > + exit 2 > +done This feature should be counted as a bug IMHO. How can f() possibly know wh= ether there's a surrounding context to break from? Having said that, this behaviour is the same in bash except that bash will = complain if it's asked to break when the context is wrong, perhaps we should complain t= oo? $ bash -c 'f() { break; echo no break; }; for f in good bad; do echo $f; f;= done' good $ sh -c 'f() { break; echo no break; }; for f in good bad; do echo $f; f; d= one' good $ bash -c 'f() { break; echo no break; }; f' bash: line 0: break: only meaningful in a `for', `while', or `until' loop no break $ bash -c 'f() { break 2>/dev/null; echo no break; }; f' no break $ sh -c 'f() { break; echo no break; }; f' no break --=20 Brian Somers Don't _EVER_ lose your sense of humour ! --Sig_/uBHsmDpijb2Gjg4/4iP+Egi Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iQCVAwUBTHIkQQ7tvOdmanQhAQJuvwP/YrtETlwy1MFtF6KPtovatQukjMX5wpWw FMX+Efgkvv6QEKYD777fngWl3igOKx2KE8Zm11sQo45r2cgfrOK5Nl1xMzQD4Neo WaCX35wwPjD+QupFOWN59XWxTroV/s1ct7DgKbscj8zvEMMwkgoK21eIoWH8kRHO b6GUHEosUQ4= =kB8L -----END PGP SIGNATURE----- --Sig_/uBHsmDpijb2Gjg4/4iP+Egi--