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 26437 invoked from network); 25 Jan 2023 13:11:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Jan 2023 13:11:25 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674652285; b=qudN0SaVwBI3GErgzENtcpUrzyiKaq9mOJZ+HxnATEW1LVZOd+hEohef4e4unBR02vOqQqJLON wXSDhM4d+6HfLyu9mvCKiNKKFnkZw17x9crN+Iahob03ucZCPGIjDXTF90kRZVg5L0LNYipZZP Cqn0w9PUpCvYfDmgtEajeDJrfKyf+pxmAkxmLnqQlMU51fg4sOSLzzitNJp3uFOfr3AWihDgSW VT8pYoeJKXc9SV9hZIuTXXSdSPTgdIRXtk/b/C/9WWGFZtAo+0HqIeDg6Ui+Z19wvzidK0KnFN t2K8B7gd08Kazq0aHxwpGbatWW+3ktvj0KkGWsumA7cavA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f49.google.com) smtp.remote-ip=209.85.167.49; 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=1674652285; bh=I3tjqCxIsr3wuLn3sBKEYWpSLvgUXDzRy4D19EYIHn4=; 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=FetKAwAEZbjspYNWR36scy6Hkh4UIEHyv+AmYbMKVmyw3i0eO5fL5iFo4h/B/lufxXQdtUk9hL 7QBpqC6cj+nZ2OBk3VBb6tiwiEL3bSCz1pjUuvdz1Ay683YBNvVQ8XM+LpsWts8Gjn1yxFm3Lf M7Eg+ZyDh0VJGl+5L5Zp0rVGr+A87shAisUhqdtEYMX+LBAbmzEf1SW0T+LPwMnah9RYEMH2Sz 01rSl9iHxk9QrWl9q7i0wWCu2ZbEvBvcZ6KhCPVHTRppXmsZixr1J/tFVwZHFtu2yKEDVTX3M6 FU4j6+feoC/TDmefZ9vQQTA8AlrjyMzkOCLUc+Y0hLFDXA==; 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=49/0wR0GWQuSbgo7iHH+3rvniE64opt+MiRU3C3xvOU=; b=D7ePcwLBJYTIJ70yfeW+tv8wKb 1Ry+BLe1Et6LuI0G63LamiphKwR1i347gQj+DoiyAkKuqxOszlbVCOz6lD7Sadw8xaoKAhyhUpVBd 9+fmJ5+62nTiUBHdjN6hi//ECqlKPIm0oac8NrQ6MSZx0RhooruKPPirGmq34GGLjNbJ9mkjs1dYy sqtVVrN17BfMJHt4F3IBNNO5HuGXMJzny2eTqLPPqoSS2kjGzcUONW7aq7FnDFY4vxqnCOnqfugsg DI/w/ax7T/LkTSsJarQ47WcuOOcLVjhVTR9E7Ww5l5s+ZOJpfi+OaL24hr45UaIsm/sOYsHIFA6uT VGP8ZiHQ==; Received: by zero.zsh.org with local id 1pKfYi-000HSr-EK; Wed, 25 Jan 2023 13:11:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f49.google.com) smtp.remote-ip=209.85.167.49; 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-f49.google.com ([209.85.167.49]:40615) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pKfXi-000Gl3-67; Wed, 25 Jan 2023 13:10:23 +0000 Received: by mail-lf1-f49.google.com with SMTP id g13so28853955lfv.7 for ; Wed, 25 Jan 2023 05:10:22 -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=49/0wR0GWQuSbgo7iHH+3rvniE64opt+MiRU3C3xvOU=; b=Um2kGMlt/qK2c0pSlrKE80v7+GWb8U2splSvnbhjdeUKWldehzUOiCcDNaC19B0ArS ZcBMhHg7igCkbfZUcTaTxOZ5bNN/Itln0xsWjhAx1LjDFYeYh8z9mxSkIJ/Q9sCUH+SJ cSM2eYlFuFn5jnS5E9oo/9w4shYaBn4imfQQy4VM99OhHFroQGlehpmu+R3uQma9NUyi Wd+LkNVSpQSK8tUtUrmKwOsGTey2BFo5BAcpTOUUa77GyL0ibRRyrrzlDLBNY2dZcwBq p+rE2eyYrHWt1r29pRbioGvQWyWxLa3JWsYroIdRi1zZoUZNapzXvgJ98rbW5mCavKpM bBEg== 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=49/0wR0GWQuSbgo7iHH+3rvniE64opt+MiRU3C3xvOU=; b=KeZyrb+GC1zKvsITapiW2HvE4NIOb/5ojjiB61YEZc0Kc7FZp3ofH8z9HhSmEWdyyw I3ZuOI2cei3MuWdsUa9MQFEnsqx7uqpkAh3KGaHWFh8UODkEN4oVtogX4qCR1p785T1T 8/QmKciccxFPyAOsEozCYfY3gn+cV+ycqYtYDtCVCHh3K//dqBUPpFAaSfHTGLuqe4tS IqCSVbHsjY174C6Bwv2GujOIZ+LEnwdyjwaTgzht0ZCUx7B4amb4c3wSiooBykDfBMw1 xyxHS96glMUhK85StwFyTcagVSf/WLWqVivHBqShUa7AS9SFPk7qPtTJ757bm/yH5277 fHtw== X-Gm-Message-State: AFqh2kqX2UaBP3Js7jFOehlo7dN1NMAwzg10TyGras8iu7EtgwZf2Et2 2ZS+jZ37GuZDTQGK2DfTDggT/U6artT5KdN3NqaL5t0++j0= X-Google-Smtp-Source: AMrXdXu3x1Czwy7B/VCDyq/i5nomyHw/EZXaTb7AtOIXC/LI1OrzBHVP+RjlbeA6KzY+PE+vf8mHirlFW+9IiA7iaiY= X-Received: by 2002:a05:6512:39c5:b0:4d5:8faa:bfe8 with SMTP id k5-20020a05651239c500b004d58faabfe8mr2301341lfu.277.1674652221608; Wed, 25 Jan 2023 05:10:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Wed, 25 Jan 2023 13:09:55 +0000 Message-ID: Subject: Re: Why a '-quoted string isn't respected by // subst, while \-quoted is? To: Roman Perepelitsa Cc: Zsh Users Content-Type: multipart/alternative; boundary="000000000000ca9a0705f3165ae5" X-Seq: 28783 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000ca9a0705f3165ae5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It seems that it's / within the '-quoted string that causes the problem: print ${QE//'0=3D${${(M)${0::=3D${(%):-%x}}:#\/*}:-$PWD\/$0}'/=C2=B0match= =C2=B0} outputs =C2=B0match=C2=B0, while: print ${QE//'0=3D${${(M)${0::=3D${(%):-%x}}:#/*}:-$PWD/$0}'/=C2=B0match=C2= =B0} doesn't. Isn't it a bug of ignoring '-quoting of /? On Wed, 25 Jan 2023 at 12:59, Sebastian Gniazdowski wrote: > Ok, I'll take a closer look, however I'm now struggling with similar > problem: > > QE=3D'0=3D${${(M)${0::=3D${(%):-%x}}:#/*}:-$PWD/$0}' > print ${QE//'0=3D${${(M)${0::=3D${(%):-%x}}:#/*}:-$PWD/$0}'/=C2=B0match= =C2=B0} > > the strings in QE and in =E2=80=A6//'=E2=80=A6'/=E2=80=A6 are identical. = Why no match? A simpler > example works as expected: > > QE=3Dqeqe > print ${(S)QE//'qeqe'/=C2=B0match=C2=B0} > > Output: > > =C2=B0match=C2=B0 > > On Wed, 25 Jan 2023 at 12:36, Roman Perepelitsa < > roman.perepelitsa@gmail.com> wrote: > >> On Wed, Jan 25, 2023 at 12:05 PM Sebastian Gniazdowski >> wrote: >> > >> > Hi, >> > I'm storing a pattern in a var: >> > >> > E=3D"0=3D'\${\${\\(M\\)\${0::=3D\${\\(%\\):-%x}}:\\#/\\*}:-\$PWD/\$0}'= " >> > >> > to then match it against: >> > >> > Q=3D'0=3D${${(M)${0::=3D${(%):-%x}}:#/*}:-$PWD/$0}' >> > >> > with // substitution: >> > >> > printf %s\\n $E $Q ${Q//$~E/q} >> > >> > The result is no match. However, if I instead quote the string with \: >> > >> > E=3D'0=3D${${\(M\)${0::=3D${\(%\):-%x}}:\#/*}:-$PWD/$0}' >> >> You can print them to see the difference: >> >> % E=3D"0=3D'\${\${\\(M\\)\${0::=3D\${\\(%\\):-%x}}:\\#/\\*}:-\$PWD/\= $0}'" >> % print -r -- $E >> 0=3D'${${\(M\)${0::=3D${\(%\):-%x}}:\#/\*}:-$PWD/$0}' >> >> % E=3D'0=3D${${\(M\)${0::=3D${\(%\):-%x}}:\#/*}:-$PWD/$0}' >> % print -r -- $E >> 0=3D${${\(M\)${0::=3D${\(%\):-%x}}:\#/*}:-$PWD/$0} >> >> As you can see, the first `E` has three extra characters: two quotes >> and a backslash. >> >> Roman. >> > > > -- > Best regards, > Sebastian Gniazdowski > > --=20 Best regards, Sebastian Gniazdowski --000000000000ca9a0705f3165ae5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It seems that it's / within the '-quoted string that= causes the problem:

print ${QE//'0=3D${${(M)${0::=3D${(%):-= %x}}:#\/*}:-$PWD\/$0}'/=C2=B0match=C2=B0}

outputs =C2= =B0match=C2=B0, while:

print ${QE//'0=3D${${(M)${0::=3D${(%):-%x}}:#= /*}:-$PWD/$0}'/=C2=B0match=C2=B0}

doesn't. Isn't it a bug of = ignoring '-quoting of /?


On Wed, 25 Jan 2023 at 12:59, Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
Ok, I'll take a closer look, however I'm now struggling with simil= ar problem:

QE=3D'0=3D${${(M)${0::= =3D${(%):-%x}}:#/*}:-$PWD/$0}'
print ${QE//'0=3D= ${${(M)${0::=3D${(%):-%x}}:#/*}:-$PWD/$0}'/=C2=B0match=C2=B0}
=

the strings in QE and in =E2=80=A6//'=E2= =80=A6'/=E2=80=A6 are identical. Why no match? A simpler example works = as expected:

QE=3Dqeqe

<= /div>
Output:

=C2=B0match=C2=B0=

On Wed, 25 Jan 2023 at 12:36, Roman Perepelitsa <roman.perepelitsa@gmail= .com> wrote:
On Wed, Jan 25, 2023 at 12:05 PM Sebastian Gniazdowski
<sgniazdowsk= i@gmail.com> wrote:
>
> Hi,
> I'm storing a pattern in a var:
>
> E=3D"0=3D'\${\${\\(M\\)\${0::=3D\${\\(%\\):-%x}}:\\#/\\*}:-\$= PWD/\$0}'"
>
> to then match it against:
>
> Q=3D'0=3D${${(M)${0::=3D${(%):-%x}}:#/*}:-$PWD/$0}'
>
> with // substitution:
>
> printf %s\\n $E $Q ${Q//$~E/q}
>
> The result is no match. However, if I instead quote the string with \:=
>
> E=3D'0=3D${${\(M\)${0::=3D${\(%\):-%x}}:\#/*}:-$PWD/$0}'

You can print them to see the difference:

=C2=A0 =C2=A0 % E=3D"0=3D'\${\${\\(M\\)\${0::=3D\${\\(%\\):-%x}}:\= \#/\\*}:-\$PWD/\$0}'"
=C2=A0 =C2=A0 % print -r -- $E
=C2=A0 =C2=A0 0=3D'${${\(M\)${0::=3D${\(%\):-%x}}:\#/\*}:-$PWD/$0}'=

=C2=A0 =C2=A0 % E=3D'0=3D${${\(M\)${0::=3D${\(%\):-%x}}:\#/*}:-$PWD/$0}= '
=C2=A0 =C2=A0 % print -r -- $E
=C2=A0 =C2=A0 0=3D${${\(M\)${0::=3D${\(%\):-%x}}:\#/*}:-$PWD/$0}

As you can see, the first `E` has three extra characters: two quotes
and a backslash.

Roman.


--
Best regards,
Sebastian Gniazdowski


--
Best regards,
Se= bastian Gniazdowski

--000000000000ca9a0705f3165ae5--