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,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14064 invoked from network); 2 Feb 2023 12:48:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Feb 2023 12:48:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1675342133; b=Z+jiE80qkwNKrVSWUfBnflbVpRPUOeTAmIBhfI4HtpdgZEvTzdIQpeLzu69mFdyKXQqm5NeANj 0ip+STBnikpk55I6PYzv3dXPd8dMRTPOTdWTibRd292WUczRyw/8ES4+NkqJPpbKGBatLbP76J PWU8m6RQNepWe8p77TDKRutfXZDzoN3RBA+bkQqm6CbgLWWeI/psdbqko0aBm6r6Klm7k15k7g 6WZau7FJ4h9ypScwT3ZOPcLsKu1LMnm3hM0RqmRiBwKhCAoLSUCOdfOl/UAr1ek8mrPQ36kpr9 UxXkOPnU34L44DJBTRaaG4lFXs459W0UFCQCrVoJQ8z6pA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f42.google.com) smtp.remote-ip=209.85.167.42; 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=1675342133; bh=r1R6AVfZ1eIaV4y2eVNeay1UlKrNB/T+kzumzFWZTsE=; 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=dVah8fCm0H6zGdvT129H+uNckpE99bZv2p5KYZSAOiwOcJY9sCFQqvgifXCwBCNBUxMpd5SU8o 5WifXzk3MVjBnlkn0D0r5ZJBsGohJo0sMY1ciRJi2namhPAAwdNYTPN6c8PklpphB4vadJ/qN8 mKXFb3nnYJAx5A+hf34rAbQVqzugOSYeD2rSlrnsCVpA64d8VHn+z88EdKT3t56eOvQpt7idib IfwROFGYplFBKEjLkFPgVm1eI1y44Pvi0FEVk9B4vVXcOkhZnFipeSLM5To/sHtfiWPPFzwtxb fDNhWiVgIQe+quCh3sWk3Y2mVSOlQEZTQRiPr5uCj0Wghw==; 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=sCRZ7jZ42OEn8O6RuV1O2A3MnzI5yvQKKMAcSNtjJV8=; b=QhxRX/aSwNQw+znOZRMEsDEPJl nGxZmzlmczPp9XQ64o/9aEFRxM0NGpHoGLBYVsuWYfMWJV5LsZnJ/5cXcErtvtU7fhPCVHAPvNYMT d6orlEQmCDywUUzUxdnnyEQnHQX4+Q8oCOerax0+D5EGg6/vjqnJq1latKB3F7cG4O+KRUiPViAHe z7iL1y9n7ZYm5x/hpmqazSkANZLwVPcCGkbKLwngRGrXn0y3MyYhVhqUWf8BhhTTwvhpcffclgneZ 0o+zP9B18WYY7M5fecpJ3kVQ8IShU7rQ/nJsk0B+0+W7Y/wjAbSdbWxnFZ4v3B1IigP6MtjosoBx0 NsEaup8w==; Received: by zero.zsh.org with local id 1pNZ1I-000N3J-1t; Thu, 02 Feb 2023 12:48:52 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f42.google.com) smtp.remote-ip=209.85.167.42; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f42.google.com ([209.85.167.42]:46762) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pNZ0k-000MjO-7X; Thu, 02 Feb 2023 12:48:18 +0000 Received: by mail-lf1-f42.google.com with SMTP id bp15so2750919lfb.13 for ; Thu, 02 Feb 2023 04:48:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sCRZ7jZ42OEn8O6RuV1O2A3MnzI5yvQKKMAcSNtjJV8=; b=luuRWvoH80LYmvzh7+5TaeIY3VaOX7nUcVoE9U39o28I/aybwkrAO6C6aR3wcXhg2M KV5IZk4vsw+KlP2Dg9MFdn7YmV8/7jP0wZbyp5QxxQ7eIcNOAf0bBJzc5vwtrbjw/5Oc PaXjvytQ4mX3NrAV1VYztuHw0t0cIH8n0r8g6NDDnxm7/bOdxCY58vOUH1dWG0tJZ/9x Vyc3oNUsGiPA92J0mWJXbB6DSMFx+1KWjF7aHcgIPc03H3FnmDvmhppnBqhsPxHL+a4B P4mTCnnqxEQjDG0JwzH/nY9UKyab5dUpMXQHZkrB2HfB7jE+HPatkL5jrc99cnfjOzwi vjRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sCRZ7jZ42OEn8O6RuV1O2A3MnzI5yvQKKMAcSNtjJV8=; b=Wd+97cQDW34EWY2tNoJ3iD5W9lNp0WQyYwOqMH/xftOk4KnwCtPW6d8nkcXH+eF8OI zA7Jgxzx6FgVOo1bCUtNP9n8CqXwmmXLPnz8JKbtbkIfckcPah5FkylsRdWxdONZACR1 HCV8VxaP8DT29pABGJITaDgqQTuz4zMubyu5Soc1oXDdGayWMOcpr9Xkkce2JAQW2ReJ ZojBCjG/7vRWEoJzZYfFocCqg7RzihXDimlIJVI4YVy0nyWADzqCT3KAjbOOf6RTrMkG aVfUDUm8HP7feLSO/XnKY5b6b+Q6vHOCiBqS5Y0d4hpJ7PAw/nS1CML/2q8EXcG6BNzN 69aw== X-Gm-Message-State: AO0yUKVYdejfjcVFqNvNFlp3uYRcCFwAUI91YeYnLDd8Og3VP9aIpD7W /e75zFrnyFnCcJv174y0CtA7WYQ0K44x0Uk8rTc= X-Google-Smtp-Source: AK7set+fO5W9k78FYm9BfhGxyuh290Bi0nwL2NWJfo/Km5tTlQJiPiT2gXhZEh8chStOn0jUptYCB4YsfG7RU6TWs/g= X-Received: by 2002:a19:c215:0:b0:4b5:6990:3c94 with SMTP id l21-20020a19c215000000b004b569903c94mr1170258lfc.27.1675342097182; Thu, 02 Feb 2023 04:48:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Thu, 2 Feb 2023 12:47:50 +0000 Message-ID: Subject: Re: #% anchoring doesn't work with (S) To: Mikael Magnusson Cc: Zsh hackers list Content-Type: multipart/alternative; boundary="0000000000009474ed05f3b6fa42" X-Seq: 51352 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: --0000000000009474ed05f3b6fa42 Content-Type: text/plain; charset="UTF-8" It does have sense to match shortest and anchor to #%, it simply moves the "weight" on the right side of the pattern, i.e. "ABC" == (?)* vs ABC == *(?) (not very correct, but shows the thought). On Thu, 2 Feb 2023 at 10:32, Mikael Magnusson wrote: > On 2/2/23, Sebastian Gniazdowski wrote: > > Could the bug be fixed? It already makes #% pretty much unusable for a > > backward compatible software, yet in say 4 years this would be changed, > if > > the bug would be fixed today > > Why would you use (S) (shortest possible match) with #% (match the > entire string)? It will obviously never have a useful effect other > than doing nothing. > > That said, compgetmatch() does this, which is probably your problem > (it gives no real motivation for why it does this) > /* > * Search is anchored to the end of the string if we want to match > * it all, or if we are matching at the end of the string and not > * using substrings. > */ > if ((*flp & SUB_ALL) || ((*flp & SUB_END) && !(*flp & SUB_SUBSTR))) > patflags &= ~PAT_NOANCH; > > > -- > Mikael Magnusson > -- Best regards, Sebastian Gniazdowski --0000000000009474ed05f3b6fa42 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It does have sense to match shortest and anchor to #%, it si= mply moves the "weight" on the right side of the pattern, i.e. &q= uot;ABC" =3D=3D (?)* vs ABC =3D=3D *(?) (not very correct, but shows t= he thought).

On Thu, 2 Feb 2023 at 10:32, Mikael Magnusson <mikachu@gmail.com> wrote:
On 2/2/23, Sebastian Gniazdo= wski <sgniaz= dowski@gmail.com> wrote:
> Could the bug be fixed? It already makes #% pretty much unusable for a=
> backward compatible software, yet in say 4 years this would be changed= , if
> the bug would be fixed today

Why would you use (S) (shortest possible match) with #% (match the
entire string)? It will obviously never have a useful effect other
than doing nothing.

That said, compgetmatch() does this, which is probably your problem
(it gives no real motivation for why it does this)
=C2=A0 =C2=A0 /*
=C2=A0 =C2=A0 =C2=A0* Search is anchored to the end of the string if we wan= t to match
=C2=A0 =C2=A0 =C2=A0* it all, or if we are matching at the end of the strin= g and not
=C2=A0 =C2=A0 =C2=A0* using substrings.
=C2=A0 =C2=A0 =C2=A0*/
=C2=A0 =C2=A0 if ((*flp & SUB_ALL) || ((*flp & SUB_END) && = !(*flp & SUB_SUBSTR)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 patflags &=3D ~PAT_NOANCH;


--
Mikael Magnusson


--
Best regards,
Se= bastian Gniazdowski

--0000000000009474ed05f3b6fa42--