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 12440 invoked from network); 20 Nov 2020 02:52:50 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Nov 2020 02:52:50 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1605840770; b=D4G2XcWm18BIy7KtTv0XfQ3LpUXIlZd6+lr7KhEZ+CYMLwEbsiluLw+Qef6HklFfAbCbudV6Ga sq9+AyfBD8qqCJzWNQ/KYLZCmrKG6oddXm19Jxq0N6smR43dAea6+ubX3vRykF6EI+iY20qbN9 lpLYvu/ITLOEKVGDmU59Oup/60S33uHs5gAlOQEb+p/GkQf5YfDprVw75eVJBfb5A/5Vjqu+E2 gLqFKwYDUqGLGmhsLfZc86WYFSr1Fr4VYtKnCBgFoBZrIytS1Mb8s+Hn42v2TytMgNCK4RvlUs irAd2RIXwlHXKRMZsGfq2Y88Y8Mco97ZQNwaJasff1t9PA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f66.google.com) smtp.remote-ip=209.85.166.66; 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=1605840770; bh=1dFkluqrolvSesHq576XporZZ8/rOOeM3LjWfTVNNpo=; 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=s+y8+Rd530jj+QjIfpMB9T8k0OVUmcYpQsUkXVFtiZimY8/PByeivjt/V+KI14tZBrP02xV/9/ amDAspf25r+uGwh4qyB+9QFY4+PesxUc9HCQMfO9FHu63teH8YG1pyxVc4HRiZPZxo5Z0sXvVb TFhmuhojRT2OXp6e4neqx2Z/CMduvqvhIxTy6yzvZdRYLxrgF8EQ44XjSYpnMpTN10HK4mpC2z BdovbCQHLuZ3y8Mndd2kqkFAgtWpsvZ14A2a8oD9qBMMLw1YGmosGYix2x4XXl+N6aChNyhYsO OKqUF8KIxBc8N5oOIlSSjL6upeggPVz1IgEnLYDiDSvgWQ==; 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: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=NZjO8PVBeEFBt35aTKsdWjddspmCagvCsOuRaDc6e7E=; b=FdzZbw2qgGOHA4QFFAqpJPy79h wtuBmzmjC0rFrsSd1lUIxB/4y7xyKYiAuB36nqtXfIpP1oFyqec6YXoaRefo8K1AnEGxjMQj/VSVt FXN3h2JQzcAf29n5poNQOcADCWC7wybHLy4AgZoS1vdffEwEwnKVIpDHYQwAzXE+ROr626E4qTb+j F3D2XGgt52+8U23zG9o25ebgI4HcVZ+YNI7b3hZ0zAfDy078YUT/URhJDq1Gct4zyLs5gwdkdDW72 T3GYbltbfYBDwgs6awThQHZlY2lu1y3qNCnDHCsKJuxSj+v6dfdxBz4aaX8/vGElVqvHlipGGVp3V b59aP86Q==; Received: from authenticated user by zero.zsh.org with local id 1kfwXV-000Bjf-S2; Fri, 20 Nov 2020 02:52:45 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f66.google.com) smtp.remote-ip=209.85.166.66; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f66.google.com ([209.85.166.66]:36037) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kfwXE-000Awq-7y; Fri, 20 Nov 2020 02:52:29 +0000 Received: by mail-io1-f66.google.com with SMTP id i18so8442167ioa.3 for ; Thu, 19 Nov 2020 18:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NZjO8PVBeEFBt35aTKsdWjddspmCagvCsOuRaDc6e7E=; b=VxrYYKC7twpU9vWzhOrZ68q3JtDlJSTF8ee0GiGdHsqC3aPvw7n9iBVeZpxXA6dwpT fAvUWx6iGlEh13yPDsoRSOiYX+LEZXxgvpWjX0AKr058jI5Lyy4DFDvC4ZPUBGE+TYf0 t5yHDqp3aGEzdP95SB06mGYu58m9NkI7rVbuNY6bkbP6AtTXn4Hqz607I0NDWGUl6qMO bAibze7oHabmmxsgmfHYA2Crqt0kWeFzVzxFbJZiE3hncYvHnbiVpCbmFRHYPdwGe5DT gTSW8JBnb8bjrA6+ZHefoqaBJQpOvEoWKGEQaWDbF4H/y1G4Y4m6pgFuWzBrNRD4SSpd Cm9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NZjO8PVBeEFBt35aTKsdWjddspmCagvCsOuRaDc6e7E=; b=i9HnlL/e1PECfstsOBsunszHV6H9ey58K8e80oUUwYNGTVns4fg6E0FYbfYPduF0dl E6PyKw4fxAVHVgrmJzNC6RhgxFN4jNsp8sXE5b46SZihxvDgebSAmW+0geourwivj62N TYA+mX2VPAvZ73xQs2gtglO4R359Cex5dOhIG0PwPspWMiXTCdK9tmZrybICkqp77w03 jNXMy1Tm/dFj3fAUog730KVnxHvJ2i01pvkADqJYilunPXFnJ5HXF2sloPGyfb6nf3ZN xTw4FWPAfVWDqThicVDMoO6kdJPR7Pek5Xy+klzn7R7hTtCIdTAilXKFFGNOxWngz8RY 9Jpw== X-Gm-Message-State: AOAM531AMbE2Ww3j2QBVlPelEU164N/VidNh1YI9hFBqP+Zyqp1yAXyr P8S77QB4H9SIGCMLeY5VjgqbbmF3l4gMu9xUe10= X-Google-Smtp-Source: ABdhPJw2vmGf98etQPg31j88Qr32l1U1LszkrYfi+EsviROYG3vL4/sWyCW3s7DBfkV6Dhie5YYyj+VTxrWLrVcjv9E= X-Received: by 2002:a5e:d80f:: with SMTP id l15mr23527177iok.21.1605840745379; Thu, 19 Nov 2020 18:52:25 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4f:6185:0:0:0:0:0 with HTTP; Thu, 19 Nov 2020 18:52:23 -0800 (PST) In-Reply-To: References: From: Mikael Magnusson Date: Fri, 20 Nov 2020 03:52:23 +0100 Message-ID: Subject: Re: Bug in completion with curly braces? To: Felipe Contreras Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 47582 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: Archived-At: On 11/20/20, Felipe Contreras wrote: > Hello, > > While adding unquoted completions such as "stash@{0}" the completion > system gets confused while inside the curly braces. > > For example, given: > > compadd -Q -- 'stash@{0}' 'stash@{1}' > > The first completion correctly generates "stash@{", but the second one > generates curly braces, the third one does the same, and so on ad > infinitum. > > I didn't specify file (-f) or any special completion, so why would zle > attempt curly brace expansion, especially if the words contain curly > braces, and the current character is a curly brace? > > Here's a simple test: > > ---------------------------------------- > #compdef foo > > _foo () { > compadd -Q -- 'stash@{0}' 'stash@{1}' > } > > _foo This test case crashes for me, the following patch prevents the crash and seems to restore normal operation, but there's probably some other thing that has already gone wrong at this point, diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 787d376a19..67546d0470 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -608,7 +608,7 @@ instmatch(Cmatch m, int *scs) r += l; ocs = zlemetacs; /* Re-insert the brace beginnings, if any. */ - if (brbeg) { + if (brbeg && m->brpl) { int pcs = zlemetacs; l = 0; -- Mikael Magnusson