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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham
autolearn_force=no version=3.4.4
Received: (qmail 30962 invoked from network); 2 Feb 2023 10:50:47 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 2 Feb 2023 10:50:47 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1675335048;
b=q+oUSFMFUipK9+uTC7zaKtjEi6kme7wqoTADDy0D1DH4UPceFJuz7h+081wt1tJukXX0vuRE9b
x4KDbOCL2qL6Oubh6Lecq2l+UpH0kBX+xSUgrtBFlS9uOalwbBQ502MJFqvbFpyVJEPuMEFc6c
GtZZs7bhcuQaDgtlONfmCYdypXy5Lvn4EblFS4Fjpmsblw+Hc8zVFE5mJgSYwISWdL3gqlhn2k
el3r6Mgs1bwJQFp0bUvj2nabwY93CJK26jH/vRVaIvkZGOoYFK3PKYrR+9i5B0MoX/hRnCf4Nm
3eWpx67Wk1+cM/MwTyqp8pQpa7Rw/CrjtZtY5+FXNGuhBA==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1675335048;
bh=1coZw1d5yiRXKle/VjpwTnUBeLFBpjPBdDKcfqoZHgE=;
h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help:
List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:
References:In-Reply-To:Message-ID:To:From:Date:DKIM-Signature:
DKIM-Signature;
b=VtNN99GUgc48ONgZh/LSv7LbTa/KzERn5fmVqoeuw+RNgPO4fhPhKgnrsfyikIG0Ntq6Wv2knf
dANwY3hvRtI9kZqX83PWmeUqDfPO88V6sGxyscVb76gBPZLsNOb/priSaiUjOxV5Y2Wha2waI7
avUZmwlEOIj7G0xQVSTTDfgpndPj+sn7wrFAeumSY16EJjNwDO50nL8TOeiJtrPIJuHEiILwKC
7plx++stBk6+H83mKdYr08l2LGi0tphrp4nUunWphdkEqHFBbJGumkSMDYcbvKhk3TtwMKvL6M
mfAoR3rfZjZPtb35hEbr+ORUx7DRVIraeT13Dcyrafcb1w==;
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-Transfer-Encoding:
Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID:To:From:
Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
bh=9WTE/1KGVcPZAcIm0FvbTq2eXMtsQ1dbgPbMmkMHf0I=; b=eEvoSFdTB/rnh+JIbnXjhXZyor
+blM5iRjsmVFesrGYtzR5pOcCUrdN1bE6sLcYbACWgwIll7dwUXSeDRV9d4HpOSW9kTNhQcigMqeS
mYFpdbmZYzGb8QPagrHWgX5rgn3DqYwWI0/0KBTX2ptmBdzkotuCXIrTUqggL2PCgXkiBkbQkcyuC
qaEc7OpcLaQKXZV7e420B2iYpylaao3vvrVgXYuTvScGRfJ9NxgJmehTPMwioCsLlV1k7jFeupu6g
Oh+/+lsABZeISCMchHacJjOZl0YboYa9OQE7seVXTraRvOHHLAGGdMET3Y/CXQg/zoW94N9J/V6a7
m1zFGERw==;
Received: by zero.zsh.org with local
id 1pNXB1-000J73-AT;
Thu, 02 Feb 2023 10:50:47 +0000
Authentication-Results: zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:54358)
by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
id 1pNXAF-000Il6-TG;
Thu, 02 Feb 2023 10:50:01 +0000
Received: from [212.54.57.81] (helo=smtp2.tb.ukmail.iss.as9143.net)
by smtpq2.tb.ukmail.iss.as9143.net with esmtp (Exim 4.90_1)
(envelope-from
)
id 1pNXAF-0003V2-DV
for zsh-workers@zsh.org; Thu, 02 Feb 2023 11:49:59 +0100
Received: from oxbe20.tb.ukmail.iss.as9143.net ([172.25.160.151])
by smtp2.tb.ukmail.iss.as9143.net with ESMTP
id NXAFpChMB6AslNXAFpin4Q; Thu, 02 Feb 2023 11:49:59 +0100
X-Env-Mailfrom: p.w.stephenson@ntlworld.com
X-Env-Rcptto: zsh-workers@zsh.org
X-SourceIP: 172.25.160.151
X-CNFS-Analysis: v=2.4 cv=c8ttAzxl c=1 sm=1 tr=0 ts=63db9557 cx=a_exe
a=Ip+kZtMD4PYul4iMASbA3A==:117 a=1DWFKdCB1IcA:10 a=IkcTkHD0fZMA:10
a=ZjyAdWuDOD4A:10 a=pGLkceISAAAA:8 a=npldXguGAAAA:8 a=x5NQcbfLuIjBlGk7I-4A:9
a=QEXdDO2ut3YA:10 a=1Z6EAcxPEhoA:10 a=Y6yEfkeh0FwA:10
a=1MEZn5qd6kv58cYvHi58:22
X-Authenticated-Sender: p.w.stephenson@ntlworld.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com;
s=meg.feb2017; t=1675334999;
bh=1coZw1d5yiRXKle/VjpwTnUBeLFBpjPBdDKcfqoZHgE=;
h=Date:From:To:In-Reply-To:References:Subject;
b=lbmfMqrHjvo9qyIOXNvs+fDHCtQbFghFwqLiG8jPyM+GDH4hLkoFeM0l4OX32MAU8
EN/Na4aRvb33gvr14N2ZpXJd7yoCZ413yHZjiKtE79qI7zbIYgPbQhtnQF5x/E+jCY
q+mXjHE8G9n3s31NXGSo4AelVF/BweFHK70mVcrE1l0O2U4euimMKhNMwqaw1J5ATI
HTfoALiYcOLIWwezKpzdW5pdWqrJum089bTED1JJA+Wd6fNZEEnYyU9YrZbCezKF3z
3pq8aTq6NcFijcFZE3EOZLii0ZdErnB1D2o20v6aDaOogmS8SiHUqGc4xujZ1lPwmm
mLc5L7Ts/KVMw==
Date: Thu, 2 Feb 2023 10:49:59 +0000 (GMT)
From: Peter Stephenson
To: Zsh hackers list
Message-ID: <1328570661.974640.1675334999113@mail.virginmedia.com>
In-Reply-To:
References:
Subject: Re: #% anchoring doesn't work with (S)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Priority: 3
Importance: Normal
X-Mailer: Open-Xchange Mailer
X-Originating-IP: 147.161.224.167
X-Originating-Client: open-xchange-appsuite
X-CMAE-Envelope: MS4xfLVkR8XyR91GiynsiiIZug+dLOzZhpp5AV7spr9XPAOaP3PP/izh7/oVTODaaF+3UqtIZDjTVsYkulbWzKwNtVTAx3MssMU7qaJt31+Ax1FMqt2+GGwE
l9zk2yPiKzw2FyW9FNmGMLQjvCavxG1ttaVKwpliFtjnXKopv4PKzQV2mpe9yXhFUT0yYeL8TBGSJ6PwJQkNVlP/s68dSLKvUe3LDoMfpAO3+ZHuBi9QGxqa
X-Seq: 51350
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 02/02/2023 08:31 Sebastian Gniazdowski wrote:
> Could the bugbe fixed? It already makes #% pretty much unusable for a bac=
kward compatible software, yet in say 4 years this would be changed, if the=
bug would be fixed today
>=20
> On Mon, 30 Jan 2023 at 12:32, Sebastian Gniazdowski wrote:
> > INPUT=3DABC; INPUT=3D${(S)INPUT//#%((#b)(*))/=C2=B0match=C2=B0}; print =
$match
> > #no output
It's a confusing combination of options but it looks like it's trying to do=
a shortest
match as if with a ${param#head} or ${param%tail} and so bailing out early =
when it's
found a substring. This obviously doesn't work when we're anchoring at bot=
h the
start and the end, so tell it to do a longest match in that case.
We could probably do with some more tests with the #% combination, there ar=
en't all
that many, so other oddities might be sneaking through.
pws
diff --git a/Src/subst.c b/Src/subst.c
index 4ad9fee1a..3dd920e87 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2926,6 +2926,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt=
, int pf_flags,
=09 */
=09if (!(flags & (SUB_MATCH|SUB_REST|SUB_BIND|SUB_EIND|SUB_LEN)))
=09 flags |=3D SUB_REST;
+=09/* If matching at start and end, don't stop early */
+=09if ((flags & (SUB_START|SUB_END)) =3D=3D (SUB_START|SUB_END))
+=09 flags |=3D SUB_LONG;
=20
=09/*
=09 * With ":" treat a value as unset if the variable is set but
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index a11652d1e..7990c2958 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2307,6 +2307,13 @@ F:behavior, see http://austingroupbugs.net/view.php?=
id=3D888
>x
>y
=20
+ a=3D"string"
+ print ${(S)a//#%((#b)(*))/different}
+ print $match[1]
+0:Fully anchored string must be fully searched
+>different
+>string
+
my_width=3D6
my_index=3D1
my_options=3DOption1