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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7320 invoked from network); 10 Mar 2022 05:48:47 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Mar 2022 05:48:47 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1646891327; b=b/z2MktpocgH0eqCV15Go3GivtzKXNHe6dU8yPUJPgrTvNiom8kXlYpXtXXNs0Y67Dl4GygwzC vTWT7AjsbFt+PXNANnP4j11KQtkDMVuskDvtLx1qRaB2QG0rycnWzsKUEuPSGXMo/awfr3mjuf W5bE5i6ZTtZIyMmiN+u539XWyBllXNCa2/So/2a03/YcJJAjnzIo5JpgWTHEp6FGyDHRzeX16P 3ECZWd1VyTtOdhRV9dPSWEUvyzrdxKTnr+UdyJAXVeMOx/dJhxdk3QFtOFams4JoBTOegCYMjl 8WCMwHzSMcIqeqIQktVciqa0D/qMIxp+tyBAlla8kXvpuw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f170.google.com) smtp.remote-ip=209.85.219.170; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1646891327; bh=iXMLu5Gaoa5EdTdIbObYcWdWH++Qs8AME49IzFFGtUM=; 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=jx19o5z8IHvxsi6G2J4lebMybwTh5lIVp4+QwWQ3hhuYKbs+q959P0OWI+wxFNwnGEaJyplWZ1 NQ7FvVb2cu+F9IDMEP/KwBNhCJtVnRmY8szLTM6rosfJi7iqxsXRSSOMcSNUTZWWTxkmDCtoX5 pgIXzPBKcJ/ZCYoM6tSBrVnteFWeI3dblnTtMnWwdneNrSmecbwa0uIFmqZ8YB1oFV+vcw6Xl1 1Kxv7rsX0ZTQcE0mFW+SN4obvuPCXOjaq6gMIdBe31h6+BqlndNGh3jw/fH6enQoFdv7P4+Sow v3Gy+l06NJ6tgMcQ4XM27K7Qk5RnTQx96QZgyHErpwUbGw==; 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: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=3xgoZJ+4voQazP4i5wvXZqruX+dQ2L4+RrqtV462ViI=; b=j8jQ5gfIUkqSkFjp0Fcunl9Zj8 u94PKOTA/LQyDB0iA4M5+kkskGzr1FfzGU1wAO1ibnT/f6Mhe3IA0BsvPNkSXVCBlshjfydeONnq5 V9UwFz+z0oQrOzIoOa5OVTq0wvmphb1aD7ZWvdOfllB3iG8BrKIpAQ46cNcnrimKOuYgitlwalhMi NDvs6OrlYSfUV7HG0y6meL9Uzff4CotEeAy8yu6HUeAa6w76HQyYVS9em63Kjyk7ovZ7U0rAOEuIW r7gqh3oxITNIT7jG2TV9f9dBsmkNEmfdBmlMpbXVrR68uH+M0foiEKwEJ/9pLfeBWCoCquDSAxJOp Gx98kOQg==; Received: from authenticated user by zero.zsh.org with local id 1nSBfJ-000MtI-HV; Thu, 10 Mar 2022 05:48:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f170.google.com) smtp.remote-ip=209.85.219.170; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f170.google.com ([209.85.219.170]:33512) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nSBek-000MYI-Op; Thu, 10 Mar 2022 05:48:11 +0000 Received: by mail-yb1-f170.google.com with SMTP id j2so8977206ybu.0 for ; Wed, 09 Mar 2022 21:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3xgoZJ+4voQazP4i5wvXZqruX+dQ2L4+RrqtV462ViI=; b=4hKsvhJOY2U9oLHEUWf61rK6UFOvxr+yg0rBoQLYyCRHr8gLBLQHv/fJIBlAr/CJhA 2lS/+USZMqGjS0zbamO9N4QzO6cnRG1z3mcpIEMPLXCJHK4nbqyJxUSXEJRBcpJ/kY/r mPGOO1Xjox/gaCygD7qKqofAzIWmDGIsSHcqX+MFqzYLer7bvLlCz7sB24rCAmT/CHkE bv1c0ASZ8rnuSr5CCTexFgdIILH2N9lqzpFH0wsZmNfTrGoUYZnxIKUYyjpY2EoBlxjn hR4jTCWTYEIRWtlo04dE66gFWawJuej67jc4F2BLzFe4OzWuqlA6JXWVG6uheTwH4TQf s8Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3xgoZJ+4voQazP4i5wvXZqruX+dQ2L4+RrqtV462ViI=; b=rZgNpUAg4JninK5UCVbktRC9B9sKQNX39NuUIZC6YYn9aKfSGRA7BOVAHMInDbjsAa uJi6ItQFlyYLGooRYKzVeYrL74fygqPi8yBHavwdTlxmMUzOt/5cT7eoOM29H7Yx+qQ+ o0Xg+tat4FDg0ym7hOViKWDQ9KX/3IklLiICqemuAOqWptutjZTUP6VwovKdrE9SghKU +beDiHFZFy/REf/zZnFE1AWozZiCdTRceTMviRA8IGVFnS1KbDL5GF+IZkAG2vqjJlve UBnWPI7WABmpancd1+g9SZfZmEx6jZkhxIZ3llPIOxxv48l4Fg7Nof+4bS23CtvkcafC RqCw== X-Gm-Message-State: AOAM531u2X15hN8jIUSrJZZW6jgAPYjfUfyHde2xsKX2yfYsDav4oK3g vK8myGiOXln891jDrUNNykYSXt/TXDfYz5mjBzQquQ== X-Google-Smtp-Source: ABdhPJwYpdxnn6CtIartHG5uVhA2L6c+32SaATBUPJY7uUfou+vLKCn5DPvjvUGsEuiemc14RfB/PK7sX63MmMho2oQ= X-Received: by 2002:a25:385:0:b0:629:2c9:958a with SMTP id 127-20020a250385000000b0062902c9958amr2812130ybd.444.1646891289467; Wed, 09 Mar 2022 21:48:09 -0800 (PST) MIME-Version: 1.0 References: <20220308193246.3204-1-mikachu@gmail.com> In-Reply-To: <20220308193246.3204-1-mikachu@gmail.com> From: Bart Schaefer Date: Wed, 9 Mar 2022 21:47:58 -0800 Message-ID: Subject: Re: PATCH: [RFC] crash with weird completer To: Mikael Magnusson Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49818 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, Mar 8, 2022 at 11:33 AM Mikael Magnusson wrote: > > type "foo " and press tab twice, and it should crash. Alternate patch below. This differs in that it initializes the "lastprebr" array, which step is skipped by Mikael's patch. > The patch prevents the crash but I have no further arguments that it's > correct. Ditto. > Also without 'setopt nolistambiguous' we just get an additional > { inserted for every tab press which also doesn't seem useful (not fixed > by patch). This is unrelated and I think connected to something mentioned elsewhere; I can't find the reference at the moment, but IIRC the gist is that because you're completing after an open brace, it's removed from the prefix in expectation of completing a brace expansion, so the suffix to be added then appears to begin with a brace, which is added after the actual prefix on the line, resulting in doubled (etc.) braces. You can work around this by quoting the braces that should be treated literally: compdef _foo foo;_foo() { compadd -Q -- stash@\\{{0,1}\\} } The patch: diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 8b5955819..a1f2ec322 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -614,7 +614,7 @@ instmatch(Cmatch m, int *scs) l = 0; for (bp = brbeg, brpos = m->brpl, bradd = (m->pre ? strlen(m->pre) : 0); - bp; bp = bp->next, brpos++) { + bp && brpos; bp = bp->next, brpos++) { zlemetacs = a + *brpos + bradd; pcs = zlemetacs; l = strlen(bp->str);