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, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22174 invoked from network); 1 Jun 2021 08:54:19 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Jun 2021 08:54:19 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1622537659; b=INnEvK7HLq8AcqJQWvo05gaycnKr5HdWHMPwVNQuxn01vmgRh5kMcI8JeZhLQfTQOjA2oaU4dH qo/13LIoJiNQ0fNX6R36wRJH0oEp1XHwIspNto+ZEyPXBj8dPfPmXC3NL77xYbVrmU3YDzqIOF 2fwXRmdth3e/4acXe2Bac9UjFqxxpHBWvc27c1KqHrUQVqytl+/ZW7luItXWIV5II7Eud8ynwx sznZj04WAk23wmSwgENL1TVSNutmtmldOiiVxfBmHrJaLWdZeAYDo8bktftftcFeXqCb+wcvRo a6lxgwVIXalA7QDHNJkthsSvL5kuFGHUF5OI1T6zOHgkSQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f48.google.com) smtp.remote-ip=209.85.167.48; dkim=pass header.d=gmail.com header.s=20161025 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-20200801; t=1622537659; bh=2rw4FPbazhXKlygQ/2Eg446jTvQJTvyXzFjtOWHJ598=; 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:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Za4qcz/zmisX1f/iPeKvlXnMYRNTHYnwiK68sBh/5OChvLv2NFRhSZac0VJZQAlJOrIUjdXi4C b6gxNTUT3H/okssbcFs0fS6V30c+2kFJlRrCTeL60xLwlpdrvCOEY6PMWHXhyh90hSOx3WCj9G ET3OFWl1nLBoyUCdelaywvYn6/A6jcT9TXkac+dHKI6TpwyYl3JoR64jS2/rg7Ew5lXb72icxk GqO5yqaPfjsRVQwD+PvnGyMdCJ5N77znYT/02r+1ZSqN+qn/eHorBZXtEJLqilCZBlXAL9hdh0 +mmyh9Nbf9J06RvBdzVaKk3YzdwG3izvmn081SDXslBCxQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; 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:In-Reply-To:References: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=7S+496boJBTRbMhh+Akds7MKS4cQ7FdcfhX4Mt5RvLc=; b=Ev0Nkb8SYAzLqv9zLVmLaOIYO2 qBef3D2gV15M5ctwa1Z7Kp7H1i5haMWBCDtKSgFEJ7X22dYXarwaKpxRp3NVzeKuaOMUZaF5LG99J midUoNc0PM1GrBQoT6tAWd0ULFRFA/+UB4kjeweNtD846FAL4dFwkDHStoAuBHuMHvbhuXocaqr7E bsad+YS6Eh7tx8KZy+tzIqsVJWmYBnY7B8BVMgN6eL7XDVWEnxjTHV65yzSWN/yDDRcYP62EbYC/A Xs3rDxfmhJkmGAKNgmiwdjSb846B7mBPXYpRIxQsEvTMvs2nu4Fk8v39Lk7JnY/TR/Wxv15+CVF1U 9vb3+jCQ==; Received: from authenticated user by zero.zsh.org with local id 1lo0AE-000EUJ-95; Tue, 01 Jun 2021 08:54:18 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f48.google.com) smtp.remote-ip=209.85.167.48; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f48.google.com ([209.85.167.48]:38441) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lo09e-000EBO-6T; Tue, 01 Jun 2021 08:53:42 +0000 Received: by mail-lf1-f48.google.com with SMTP id r5so20594943lfr.5 for ; Tue, 01 Jun 2021 01:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7S+496boJBTRbMhh+Akds7MKS4cQ7FdcfhX4Mt5RvLc=; b=JBDsxlsaOMmMBhwYlj6eM0UAWonojqVOkVUmfYMeM8rSZJ1Pq2frxn2vTSNOlzA7wt rtf1dy3uIpXC+YJSavRmdecZBg5I6M5/wp9SZ9Pn1eNIA/rWNWjsJqG63MWJCz8NmsXD gQFq1bnLOkUb78W+g0t1bC5QeFzSGyhViICAq397Eh79vFXS9eD2SBBOoVO3JC2Fwz9q 4XL4D4RbgzgIg03k8Z6wTGW4ZPUi3nGiQ75y4KYwxwRYff+LsUONAdVp0EF3ivPsXwUR QM1uV3M0xDawcghMwRlCgoAVNAC4xjqNVZJ0f1Gatr+nL0rGRhouXFZ+HnDaXMLNMrO8 YgVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7S+496boJBTRbMhh+Akds7MKS4cQ7FdcfhX4Mt5RvLc=; b=k8c8joV3/LDUr2h9AYKySr+WdJdOVlEgO12KeblMQLtQcTLoLXe+aRniYRRma9UYIf JModR4KhpJXAWgDpOTizeebQUye9gfBx4t3M4MT0k1+/QfuVVZWkQcoXDZoJ/ENhfPio BxJR3k2MpgwQkMYOedC+dj4BicwnUq1bMC7OznsTykXtUj2clkFcjqwIs/4kJOSUHm47 CzKmdVKCXYY7Q9dgDQOleYGoYugtIz1TT8Ijv4PHEuQ9G6FFA7z1KoQIWdHlFvkedC/A Ri2r3rwYqCtlfs2f7Fy3kai6N8Lxq7Cz2ArLFmr8gXeP7T7wV6J1hFroWCX9QKSvDK/3 J3tA== X-Gm-Message-State: AOAM532kxZOAEeGeuxZzbcyoEiS2twW7cylMzR6BD1cuX5+qwQYIGzI4 ZUZlfTD/xG/HsrlSUmRtATUmh92qOwNWFolFi7eq5uyOmvGkAg== X-Google-Smtp-Source: ABdhPJyQ+Kw11gNER2eX9qJXQPTADE/Y02eJksTghQ0/CFUdRdCXtAaYlyQx58Zuqya9cmoaFwQN7yHZ4HrYMcmqB8g= X-Received: by 2002:a05:6512:3d13:: with SMTP id d19mr18115726lfv.307.1622537620967; Tue, 01 Jun 2021 01:53:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marlon Richert Date: Tue, 1 Jun 2021 11:53:04 +0300 Message-ID: Subject: Re: [PATCH] Fix a logic bug in _zle To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48977 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 Tue, Jun 1, 2021 at 12:56 AM Bart Schaefer wrote: > > On Mon, May 31, 2021 at 10:49 AM Marlon Richert > wrote: > > > > On Mon, May 31, 2021 at 8:08 PM Bart Schaefer wrote: > > > > > > For purposes of the commit log, we should be told what this means in > > > terms of a behavior change. > > > > Is it good enough this way? > > Better, but you could have just said that in the email text rather > than embed it in the patch file. Ah, OK. I thought you meant I should include it in the patch itself. > However, I can't figure out when $state[1] == widget-function is ever > true. Did you possibly mean widget-or-function ? If not, can you > give an example? Sorry, typo. Yes, I meant widget-or-function. But actually, I realize now that I made further mistakes in my explanation yesterday evening. I'll try to explain better. What happens in the unpatched _zle code is this: * On line 54, `;&` causes the (widget*) case to always proceed to the (function) case. * On line 56, `[[ $state[1] != *function ]] ||` checks to see whether the flow should actually continue from (widget*) to (function). * However, * when `[[ $state[1] != *function ]]` is true, * then we correctly skip the _wanted call on lines 57-58, * but because the _wanted call is followed by `&& ret=0` * and because || and && have equal precedence and are left associative, * then we incorrectly do `ret=0`, So, to correctly summarize the bug: When $state[1] == widget, _zle always returns 0, instead of returning 0 for success and non-zero for failure. The patch fixes this. If you could update the commit message accordingly, that would be great. Apologies for the confusion.