From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15880 invoked by alias); 30 Dec 2012 19:36:04 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17509 Received: (qmail 3598 invoked from network); 30 Dec 2012 19:35:51 -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.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <121230113526.ZM967@torch.brasslantern.com> Date: Sun, 30 Dec 2012 11:35:26 -0800 In-reply-to: Comments: In reply to Russell Harmon "err_return inside function who's return value is checked" (Dec 30, 2:52am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: err_return inside function who's return value is checked MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 30, 2:52am, Russell Harmon wrote: } } why does the following print hello? } } (){ setopt err_return; false; echo hello } || : } } is this a bug? It seems to be in the realm of what might be called unreliable behavior. Compare bash 3.2, for example: bash-3.2$ foo() { set -e; false; echo hello; } bash-3.2$ foo || echo goodbye hello bash-3.2$ foo && echo goodbye hello goodbye bash-3.2$ foo [exits] err_return is supposed to act just like err_exit, and err_exit does not cause the shell to exit when used in a conditional expression, and so err_return does not cause the function to return in that circumstance. This obviously is a case where err_return might be permitted to behave differently without causing too much consternation, but that's not how it has been defined.