From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22955 invoked by alias); 4 Jun 2014 02:12:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32693 Received: (qmail 3495 invoked from network); 4 Jun 2014 02:12:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FROM_12LTRDOM, RCVD_IN_DNSWL_NONE,T_MANY_HDRS_LCASE autolearn=no version=3.3.2 From: Bart Schaefer Message-id: <140603191227.ZM28198@torch.brasslantern.com> Date: Tue, 03 Jun 2014 19:12:27 -0700 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Oddball output from zerrmsg() MIME-version: 1.0 Content-type: text/plain; charset=us-ascii There's a discussion on the POSIX mailing list about "break"/"continue" RE whether they should affect only loops "visible" to the statement (can be thought of as "local" scope) or also those in calling scope. Shells differ on this point. That is, currently, given: foo() { print FOO; break 2 } bar() { repeat 2 foo; print BAR } baz() { repeat 2 bar } The zsh behavior is: % foo FOO foo:break: not in while, until, select, or repeat loop % bar FOO BAR % baz FOO % Note that "break 2" has interupted the loops in both bar and baz, even though neither of them was in the scope of foo, and has thereby short- circuited the "print" in bar. With the proposed semantics: % baz FOO foo:break: not in while, until, select, or repeat loop % If we edit foo just a little: foo() { repeat 2; do print FOO; break 3; done } Then (with the proposed "break" semantics): % baz FOO FOO BAR FOO FOO BAR % Thus "break 3" has interrupted only the innermost loop, the other two in bar and baz are considered out of scope and proceed normally. I don't have an opinion on which of these is preferable, this is all just background material. Now for the strange part. I applied a small patch to doshfunc() to implement the proposed behavior and ran "make check". I got exactly one failure, and it's a false positive: ============ ./A07control.ztst: starting. *** /tmp/zsh.ztst.err.64460 Tue Jun 3 18:57:24 2014 --- /tmp/zsh.ztst.terr.64460 Tue Jun 3 18:57:24 2014 *************** *** 1 **** ! fn:continue:1 not in while, until, select, or repeat loop --- 1 ---- ! fn:continue:1: not in while, until, select, or repeat loop Test ./A07control.ztst failed: error output differs from expected as shown above for: fn() { continue } fn Was testing: continue outside loop ./A07control.ztst: test failed. ============ What? Where did the colon after the line number in the error message go? Why has it not been there all along? I don't see the code path by which that colon would ever have been omitted, yet A07control.ztst clearly was not prepared for it to be there. Any ideas?