From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29278 invoked from network); 28 Mar 2023 11:19:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Mar 2023 11:19:47 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1680002387; b=rxJgHBt24WIiL6WTNwBn7OdF2Brblp8lEN9WUrGhTvAmiAqaWKYfkuOzKKyenWZIi75EUlTbyX 4CWpM5KSkbmIKYX4mh780VgIc2E2E+nwd71IrN7HhMOUM0sAp09E+VOn62XIX1iAwUwFFp/8Cn WHfHbc0o8vnxj8OJJtn9Mu/HTSHU8ICeyOXJmQic4oBHkUG2ARHzJdnJaEwwbARMZHJ6L5EBab JARtUPdlWItSIYhsJ+2rij635Vsa8CzB1ORvlX9PwVMO9KLMGZ/T6ia4cmufEBUu+yc9aIasee b1yAk1PYpN+XpArXUOzAqk1n0ErW9M2pkHPnf1o2Dparew==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1680002387; bh=G4HKRlKYP7d9lwpb6qszYPWXPDsKQXo3d4YtqAlQoAU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=Wz2vGdA32CvmooXvZHuv9+juWtXGNwky/VYa/nGfxV6xVYUnDCl6/uTEw0+a7aYgVZRAoE8kLs 549PT8EH/LiZVd/PdF5ZUL84HPscIfj5ycYWBEaWqp841K4brj7yeHJUs9s7uZNRJrqyuyh+yM vlKcrAgbLZG3yWNaTsiVsUJUMmDcugLBuQ4C3TPEfvurj8L8Upw4nrA33L+jAbwl+ye6n669A+ nDk8q1dlhxP39yyJnQTTmTROwXUj2s0uUbn46rKNbZdPQDuI6f+C5JS1q60M0MsRsyBbhsDZSn jnRj7Y5n79gWasGQjdzWqypRxabknnNV3n1cPkMd2OTcsw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Zr1nhmVE6hLDpXwTP3SoFPvGFtM7CWYt1J97FRH6N9w=; b=Z/CnZofPl3Xz/3Z+cBOou4Leu5 1orVi+mkT3J3OZvstdxXroqxjouI+2rOBNLEHDvwncg+VweLnNqnXFXa+N7H01pZveXKvE2VJtVOD YmKDr3/EMazyQ3oO4T/9BmGhbodZ+RinMql+FR+IWIa2QpJ9qwhvjW/bpr3kOj7OC5mp/SGXBW2K+ xDxANPDr6wCp2uVIOj5AaonPXbvonA1b5ofe8QgWjmBTWwbbQJImBVc0CauNLACH8wiL/4JSAhNoi DCwxdMXbStB5hFy/JZChmhxZVHMRogOxeXj/yv9k6d6jrfucpdwTBj7zVM36KjYbzC/UszYGPHN/C d3tkZl3w==; Received: by zero.zsh.org with local id 1ph7Mh-0003Cp-1S; Tue, 28 Mar 2023 11:19:47 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f48.google.com) smtp.remote-ip=209.85.208.48; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ed1-f48.google.com ([209.85.208.48]:42888) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ph7MR-0002uL-Mm; Tue, 28 Mar 2023 11:19:32 +0000 Received: by mail-ed1-f48.google.com with SMTP id er13so7147954edb.9 for ; Tue, 28 Mar 2023 04:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680002371; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Zr1nhmVE6hLDpXwTP3SoFPvGFtM7CWYt1J97FRH6N9w=; b=aujfoLbm85MquzR4RqoxT4rLKd4axTZGR/B79YV0+ykZL+bq+o51gWnsR7Fu87UhiA nu1b3b7NY5UFTPWlWX42gBmsRJQcpUD7UpwIWJ/cV5CN6+HCxkeuZNXxnbo7LWdP/Txe gLEyb4PnWFHDgbQc8TOO5LFhqulM+3gaWeXWacDpz4poFy/4otrmBuWUsLm7kTyXtDya 3ag5WVuhqKEOeEvj0JqyFQmOiTiudK0RtbNGJCUTqmX//kHMAhf0XRltn6oPvSq9k9FE RrWs+v/KTUpZFDwcDkvtMKWsZ5kttx5O8eaG4SJ+hHU5KWikLfh8bzJ+LyDNZS5p/qFf QmPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680002371; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Zr1nhmVE6hLDpXwTP3SoFPvGFtM7CWYt1J97FRH6N9w=; b=toe8qXYN/3n7D4S/JvDGB5wSEJz1B+T1w4eJMG8wbMmfJ+EdDimKt+lVS07bhimByE UzvfbS83G/hH/g4dRhkjGTPGNmQrh5NYn0QdnF8fww2ADi7bVUBc7kgnHPkBfzDEj731 5zn85mZTQJMu+UEqX1EWT4aEL0soiPZ+60lmGJdH6MO+q5ISkD++oam+Gqh8/QwLVBAO QcVajt/vN3Zqnj7sgB8WgYLbHHIeG9ypusUDDri0xOzoptssHXuO3oxrhW/0hXl34PRQ GKBsU0qNuCm2sBFYBTGVdkTlwqVpy5ed/6kWQ2rQ28et/J3g6nQKV2I7hLttKQ7ktdok tWiw== X-Gm-Message-State: AAQBX9eqkpZkaRAkgD03ipeV6+qUvdA8CcFcksqVlkqtEf74bTDx0vLq Atw8j4CTpKaijaTt8WlvKe6akUSkW+f7W2nrsUmlEufb X-Google-Smtp-Source: AKy350YoC2TCYvlFXrjVYUtLA4e+HVbc10ZKfz1QEGgIIYu4RkmIUqswE4fb08EDuAU/xaf7wnvHNL47R/ImdbU38ps= X-Received: by 2002:a17:907:80a:b0:8af:43c6:10c0 with SMTP id wv10-20020a170907080a00b008af43c610c0mr9578575ejb.1.1680002371116; Tue, 28 Mar 2023 04:19:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:907:1c8e:b0:938:9972:ff53 with HTTP; Tue, 28 Mar 2023 04:19:30 -0700 (PDT) In-Reply-To: <16795430.3614208.1679998628194@mail.virginmedia.com> References: <16795430.3614208.1679998628194@mail.virginmedia.com> From: Mikael Magnusson Date: Tue, 28 Mar 2023 13:19:30 +0200 Message-ID: Subject: Re: Bug with continue? To: Peter Stephenson Cc: zsh workers Content-Type: text/plain; charset="UTF-8" X-Seq: 51606 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 3/28/23, Peter Stephenson wrote: >> On 28/03/2023 10:32 Felipe Contreras wrote: >> I notice this works differently in zsh than in other shells: >> >> for x in 1 2 3 4; do >> continue && >> list="$list$x " && >> echo "x: $x" >> done >> echo "list: $list" >> >> Why did the statement after `continue` gets evaluated? >> >> The original code tries to do something useful `case "$x" in 1) >> continue ;; esac &&` but it shouldn't matter. >> >> I tried in bash, ksh, and dash, and all of them continue immediately, >> except zsh. >> >> That can't be the desired behavior, can it? > > That looks like it probably ought to be regarded as a bug to me, yes --- > I guess it's been hidden because the test "if this statement successfully > jumped somewhere completely different then..." isn't spectacularly useful. > However, it's not logically wrong, either. > > I think we had something a little similar to this recently; it usually > boils down to something quite simple once you've found it and I'll > have a look when I've got more time. (Patch would go to zsh-workers.) Some observations that may or may not be helpful: Replacing continue && with ! continue || has the same effect, chaining continue && false && a=b still does the assignment, doing continue && { a=b } works, eg it does not do the assignment, same with if continue; then ... -- Mikael Magnusson