From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1824 invoked by alias); 8 Jul 2018 23:17:10 -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: List-Unsubscribe: X-Seq: 23530 Received: (qmail 19885 invoked by uid 1010); 8 Jul 2018 23:17:10 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f45.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.214.45):SA:0(-1.9/5.0):. Processed in 1.434418 secs); 08 Jul 2018 23:17:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) 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, SPF_PASS,T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: daniel@santana.tech X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=santana-tech.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=rLdvA4fGpWP6aZ8lJW1LfTcshYu7TbpS0ZW9aRKuNwc=; b=oAyP92Szr+3PNd+oktXjkI7OFtlEC4X0JVgC42eUUg2qSAG+iu2Y6KhR0EhiBIn8RV GKKLI9nMUgZPr16WSy6/aSEVMNuNdY4R7U2Pey/hmgCCclkebx/TjzCl+yJWrJ9ciR04 YSiqWxD/NRvFHNK5XA5wWZBXY8Vk1/KSYUpJygriJJZrYqBRBuJQpskTzOQvi5xMiozR +6jh0pAmpsQkVf8wTjx0dhiEf/agXrw5paaeeP510SqhO885cUdRvvDWJHNQUN9s1gaT 7QT1vdalwTvHrYT05XnOfPeE4zqH1xjWBVe1cVIATSMa2iDz5FcVRef9TLZsLZ/2PxR2 HswA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rLdvA4fGpWP6aZ8lJW1LfTcshYu7TbpS0ZW9aRKuNwc=; b=CpSOjm4NkJacuGIO5J4tfT0K3G+D7Rk4azPgrysOJL0ozFv8bK13Bc19jtYDRNpZnq yOu101pjbpfzFrsZFT7RfGQx3b2crhivPsfbcrnw5ObOP1FjTTrrRcEAYhd2XNN97fLR 9ZpSZu4+KL+ND3fpep/8dBvb7ingNMZJlK/3cn59zbU4ShKPWlvw31AedqhcBiQ97HOi pmQClwSKAcEcOB98MAI5DhVKgV1GHU6LHCpOoZTzmX0Ey/4N5mC8+pIBGJONAZ9C55El I3SW/RpcenGyeQnLmdIRpfyc3iVV5GbXRafwdbZlaiZBqS+jKj/5LV7JXA5FXe/Rf8Uz S5fg== X-Gm-Message-State: APt69E192gGkQp1N0HFpmWHfMiOZQyL63mFN7OluRFOYoC0yIU5eIsSI q2H7UcTcz5XGgCzcPWfMZWW3jToF4elvnJi4zM9KUaut X-Google-Smtp-Source: AAOMgpdykaaqYxC3YPMg1BbpJRkppKPqKuHUPT1uMpitntsPNnPP79G9K5xHJ6/FdmztspIuShgZBXgOU8gLPCedNwI= X-Received: by 2002:a24:5cc8:: with SMTP id q191-v6mr14717221itb.63.1531091825828; Sun, 08 Jul 2018 16:17:05 -0700 (PDT) MIME-Version: 1.0 From: Daniel Santana da Silva Date: Sun, 8 Jul 2018 20:17:05 -0300 Message-ID: Subject: Unexpected err_return behavior inside if/else block To: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" The following script outputs "status: 1", where I'd expect the script to exit right after the called function failed with the `false` statement: #!/usr/bin/env zsh setopt err_return function { if :; then false; fi } echo status: $? But if the function is replaced in the following way, the last line is never reached (as I expected): #!/usr/bin/env zsh setopt err_return function { true && false } echo status: $? It seems that the "err_return" option is not respected by the caller when the called function is exited from inside an if/else block (and other blocks too e.g. `repeat 1 { false }` or `for i in 1; { false }`). Is this the intended behavior, or is it a bug?