svn commit: r211609 - head/tools/regression/bin/sh/builtins

Brian Somers brian at FreeBSD.org
Tue Aug 24 17:57:57 UTC 2010


On Mon, 23 Aug 2010 23:58:50 +0200, Jilles Tjoelker <jilles at stack.nl> wrote:
[.....]
> > > ==============================================================================
> > > --- /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 2010	(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
[.....]
> > 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 too?
[.....]
> Warning messages to stderr mostly get lost in the noise, I don't really
> like them. I do not expect people to test for failure of break and
> continue, and bash even sets $? to 0 despite printing a warning. If this
> error is so important as to need an error message I think should abort
> the shell as well (via error(), so that "command break" will avoid
> aborting).
> 
> Furthermore note that bash disables these warnings in POSIX mode.
[.....]

I agree then, no error seems like the right thing to do.

Thanks.

-- 
Brian Somers                                       <brian at Awfulhak.org>
Don't _EVER_ lose your sense of humour !            <brian at FreeBSD.org>


More information about the svn-src-all mailing list