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 24495 invoked from network); 12 Sep 2023 20:10:14 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2023 20:10:14 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1694549414;
b=XYWigBFZncwayrGryBLWNj0le+7yAW2jWkfoRjHNr8aVZKyC1Ox+e3LNavrUL/mQKkYBojsRzV
BRoVMS5bJQSuXmI1LB+uRHUKQXqJRGogArPB1yv0whx5+llB8ZPDWb6B12BnZGboIKcgcS6PR7
a/N8HURXBqIj4I4W2uW/66D9FkSLhODCKEiuecxlBMthbSK/bIgNcbkuRYBPH6UfzLES8T73eA
4AvLaIfAzzvu559ztufzHgV+T7xVLxVVSqtMTLe/jhT73M0sIkB+G0yMzbWk5uq/IRZ3uS4QFG
s0GSivvfF9K37BJZjrPCUw6uAN0uVVlOiEhgl3HyRgtcXw==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (csmtpq2-prd-nl1-vmo.edge.unified.services) smtp.remote-ip=84.116.50.37;
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=1694549414;
bh=Z1AXrmeZeH1nSNE54XwaZvCh66yA5umI5FundTtsA6k=;
h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help:
List-Id:Sender:MIME-Version:Content-Transfer-Encoding:Content-Type:
References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature:
DKIM-Signature;
b=mSBMHxVJWuzRX6Q3qjYlEBAJRdgaa2lhM4HHFLRcf0SmQXx5M60OIcNA+XauaI0pQW5Cbgc4Aw
MJRiEox/M5Bmm0hxnydlvQYQFagvPR0iGwb1SOOp5JvMnFKqtlnUotoMdi3FMMcsvcpYlhetwj
V3GlQ4EYdbPfCPuVLGas5nrdkwYPPUW4ZPXtwErlkaetqHh7HWBfgvK5jzSpk9BycN5iz16NXK
PB06rzMdye/+A34YJJjUUeFSHKs4EbFfDHke380opyaDIgnLEtWuNvVls8zrSbUzax4nQ1brNI
7/S9IW7B/hML39yavQrR1iQch4Z86E8OMvQTllNOA3ZhoQ==;
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:MIME-Version:
Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Date:To:From:
Subject:Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:
Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
bh=xUsQRv/BRJw+19Kdaa1RMXjYxWULgowHfJWnzpf1WrI=; b=CQh5CS6J+4VOXa8q1X0VxjCz2e
C7+xci/71qh+oJeD7b8ZQWQ9NY7GKDbH3GVlck4DNZdoGCao4GJ+Fcm7MqOW6Esp9Rx5M6yPMbvKi
bZJMl7xSImHIdsv+DzHBuVaupWYLjNwveVuREJSyVGlbPpFMLRfJgTX1vHx0KYY/Jwso7f7lmt9sK
1yWTCeYXDppcS+Ernr7UyvZZgC/+PqnFrUovs5qejHihiAZ5N4qrP9ciYXuEjKUTijDSn1sRr1UyE
iHfmehE0O0zwFTuNgcKt/0bqY0RsSBguNSwQUNfcGAhySgW/TZqjugJXAYA+wD61g2/20egATbsUz
gjX1z8Rg==;
Received: by zero.zsh.org with local
id 1qg9iA-00032K-FY;
Tue, 12 Sep 2023 20:10:14 +0000
Authentication-Results: zsh.org;
iprev=pass (csmtpq2-prd-nl1-vmo.edge.unified.services) smtp.remote-ip=84.116.50.37;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from csmtpq2-prd-nl1-vmo.edge.unified.services ([84.116.50.37]:53799)
by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256)
id 1qg9fS-0001FS-UO;
Tue, 12 Sep 2023 20:07:27 +0000
Received: from csmtp1-prd-nl1-vmo.nl1.unified.services ([100.107.82.135] helo=csmtp1-prd-nl1-vmo.edge.unified.services)
by csmtpq2-prd-nl1-vmo.edge.unified.services with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
(Exim 4.93)
(envelope-from
)
id 1qg9fR-000G3S-Iq
for zsh-users@zsh.org; Tue, 12 Sep 2023 22:07:25 +0200
Received: from [192.168.0.92] ([82.1.229.179])
by csmtp1-prd-nl1-vmo.edge.unified.services with ESMTPA
id g9fQq8notkjH0g9fQqXaII; Tue, 12 Sep 2023 22:07:25 +0200
X-SourceIP: 82.1.229.179
X-Authenticated-Sender: p.w.stephenson@ntlworld.com
X-Spam: 0
X-Authority: v=2.4 cv=XJH2CytE c=1 sm=1 tr=0 ts=6500c4fd cx=a_exe
a=W4rGJ7PGCSRRUvufKHO8Dg==:117 a=W4rGJ7PGCSRRUvufKHO8Dg==:17
a=IkcTkHD0fZMA:10 a=zNV7Rl7Rt7sA:10 a=DdrXR03oVXmzHURDXfEA:9 a=QEXdDO2ut3YA:10
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com;
s=meg.feb2017; t=1694549245;
bh=xUsQRv/BRJw+19Kdaa1RMXjYxWULgowHfJWnzpf1WrI=;
h=Subject:From:To:Date:In-Reply-To:References;
b=FpT6z8pao+a0q0UgoW+DbSEVUK0IdZsC0pIvjboRt08U3VNu/t51II5beR2uFQs7b
++xearMQ5GpmfswbXlLyOTbnAXtRJ4TB6J9l34nj8pkIWwW86A/gdTgrYr5ndO98VM
XyH6SkNE64HF7giOpWON8aFD0DmaRqbYpL8gpyoTf43DBNnoeoMpTGxMCqJTnVBTwB
uZi7IDpaDoVHdCFsdd5xJeNRrQbOZgkeqIyc+N7ejqCcoQi6N8SHqHwBQZgFY1dFAk
C8iGf/++PhDmuWQbvyOboiutcpy0Eg0JilWFEEYt9gLrrhXpYFwsLIMlQXCBVxgQGA
dRkteFV1LR1cA==
Message-ID: <8218b46632e67c16b18187612d0b0d51491cd30b.camel@ntlworld.com>
Subject: Re: quoting question
From: Peter Stephenson
To: zsh-users@zsh.org
Date: Tue, 12 Sep 2023 21:07:24 +0100
In-Reply-To:
References:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.44.4-0ubuntu2
MIME-Version: 1.0
X-CMAE-Envelope: MS4xfKaaVIgaBgt3GQxh7MCdi0rXhla1tCAlaZ71HCmMdxZjFXF1g3WpM/Jq2cMK/IXey78OW5CiWKY3LyMF140nyrsHd/C/d1hQ9ymoHX1+JAIQOuclKkb4
c9wkze2Q3md7TxtxRRk5k09EkVDGMEqoTyLQ695eqLGTAi+GtbbZj+qxK7hn72SZmUrq9jo30Ydk0g==
X-Seq: 29233
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:
On Tue, 2023-09-12 at 13:45 -0500, Jim wrote:
> Hi everyone,
>=20
> Zsh quoting at times makes me wonder. Do quoting? Don't do quoting?
> The following case has me scratching my head.=C2=A0 Can someone explain w=
hat is
> going on?
>=20
> datetimetest ()
> {
> =C2=A0 local =C2=A0 =C2=A0 DT
> =C2=A0 DT=3D"${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}"
> =C2=A0 print $DT
> =C2=A0 DT=3D${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}
> =C2=A0 print $DT
> =C2=A0 print -- "${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}"
> =C2=A0 print -- ${(%):-%D{%Y-%m-%d %H:%M:%S %Z}}
> =C2=A0 print -- "Date and Time: =C2=A0${(%):-%D{%Y-%m-%d %H:%M:%S %Z}} Te=
st"
> }
>=20
> Output:
>=20
> 2023-09-12 13:21:40 CDT}=C2=A0=C2=A0=C2=A0 <--=C2=A0 why "}" when quoted
> 2023-09-12 13:21:40 CDT
> 2023-09-12 13:21:40 CDT}=C2=A0=C2=A0=C2=A0 <--=C2=A0 why "}" when quoted
> 2023-09-12 13:21:40 CDT
> Date and Time: =C2=A02023-09-12 13:21:40 CDT} Test=C2=A0=C2=A0=C2=A0 <--=
=C2=A0 why "}" when quoted
That's a very, very good question and I'm very glad you asked. Er.
It looks like we're not couting brace pairs within quotes the way we do
outside. I suppose the reason for that is something along the lines of:
if we encounter a "{" inside quotes it=CA=BCs just a reguler character so
doesn=CA=BCt have a special syntax associated. But the inconvenience of
counting braces differently just because you=CA=BCve added double quotes su=
rely
outweighs that.
The fix is something like the straightforward tweak at the bottom, though
this causes a failure in Y01completion.ztst that needs tracking down.
The test is
comptesteval 'comptest-postfunc() {}'
comptest $': *\t\t\t\t\t\t'
0:_expand shows file types
>line: {: dir1/}{}
>DESCRIPTION:{expansions}
>DI:{dir1}
>DI:{dir2}
>FI:{file1}
>FI:{file2}
>DESCRIPTION:{all expansions}
>NO:{dir1 dir2 file1 file2}
>DESCRIPTION:{original}
>NO:{*}
>line: {: dir2/}{}
>line: {: file1 }{}
>line: {: file2 }{}
>line: {: dir1 dir2 file1 file2 }{}
>line: {: *}{}
and the failure is (even though all braces here are balanced)
--- /tmp/zsh.ztst.38062/ztst.out 2023-09-12 20:52:55.852041189 +0100
+++ /tmp/zsh.ztst.38062/ztst.tout 2023-09-12 20:52:55.988039951 +0100
@@ -1,15 +1,6 @@
-line: {: dir1/}{}
-DESCRIPTION:{expansions}
-DI:{dir1}
-DI:{dir2}
-FI:{file1}
-FI:{file2}
-DESCRIPTION:{all expansions}
-NO:{dir1 dir2 file1 file2}
-DESCRIPTION:{original}
-NO:{*}
-line: {: dir2/}{}
-line: {: file1 }{}
-line: {: file2 }{}
-line: {: dir1 dir2 file1 file2 }{}
+line: {: *}{}
+line: {: *}{}
+line: {: *}{}
+line: {: *}{}
+line: {: *}{}
line: {: *}{}
Test ./Y01completion.ztst failed: output differs from expected as shown abo=
ve for:
comptesteval 'comptest-postfunc() {}'
comptest $': *\t\t\t\t\t\t'
diff --git a/Src/lex.c b/Src/lex.c
index 2f7937410..30d69a28b 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1584,6 +1584,13 @@ dquote_parse(char endchar, int sub)
} else
err =3D 1;
break;
+ case '{':
+ if (intick || !bct)
+ break;
+ c =3D Inbrace;
+ bct++;
+ cmdpush(CS_BRACEPAR);
+ break;
}
if (err || lexstop)
break;
pws