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=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27315 invoked from network); 25 Dec 2021 05:35:57 -0000 Received: from tb-ob0.topicbox.com (64.147.108.117) by inbox.vuxu.org with ESMTPUTF8; 25 Dec 2021 05:35:57 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob0.topicbox.com (Postfix) with ESMTP id 0D6E43B512 for ; Sat, 25 Dec 2021 00:35:56 -0500 (EST) (envelope-from bounce.mMde1c714fd9ca1af9f3407d8d.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id 0A5E5D3A0B1; Sat, 25 Dec 2021 00:35:56 -0500 (EST) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=qw5ymROA header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f49.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type:list-help:list-id:list-post :list-subscribe:reply-to:content-transfer-encoding :list-unsubscribe; s=sysmsg-1; t=1640410555; bh=0gfuDgo4WFmh2K0c myQTrsNmxHczr5MwTw7ZtvMRndM=; b=j6s5SWNmc28s4FAjby6E0oYiD61KDGVr TMhum+GnY9DIifKfpiDdDBc10JXTlw9SyPTG44XlIaYSFmBNeT5JneHvIbPVA/W1 Os5JH3RQhN3MHHWfg06DcCsoHoR+qChk2U0cM4lREUaoiX5VoLv/OoFUD8mgl3UL iEw/L60TVqY= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1640410555; b=DwI/wFsHzbe132Wv6SIjpdEMpQr5ocTL+lybjzSDlKwlWYh61c xwir313j2UlH8J2izZX+6UQ115jTjXH6umUsMFGUp9oCwNqxo8DpmnR1IHCiCQVO iEsAUFla14mBTxXe5brPID99RMcPrPDNlnc9J7HVo62soVFHIxmLtEz0w= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=qw5ymROA header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f49.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx0.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=qw5ymROA header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.210.49 (mail-ot1-f49.google.com); spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f49.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=4kohpC0X; x-me-sender=none; x-ptr=pass smtp.helo=mail-ot1-f49.google.com policy.ptr=mail-ot1-f49.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt3.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt3.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h= mime-version:references:in-reply-to:from:date:message-id:subject :to:content-type:list-help:list-id:list-post:list-subscribe :reply-to:content-transfer-encoding:list-unsubscribe; s=dkim-1; bh=9oXZ4WKsv5pZr+izm/xbtDfQpJfERaHp2w4a+VxLuns=; b=iyBtN19P3gI6 RNYZniG0LR2qjyf/Cn4LjThmHN4p3NQyV8Q85xAMbac94PMsDPjIoLV6aoFt2Z7E rNnp6uWzpqOmlmePrmC5xchWhSJFp39XH+XM39SLIBR+Uq319V6D+x5XmdwWi2lQ zVs4qf80nQ+SVsSkb0nMmE0OTM/YwFo= Received: from tb-mx0.topicbox.com (localhost.local [127.0.0.1]) by tb-mx0.topicbox.com (Postfix) with ESMTP id A9E7BD39CB3 for <9fans@9fans.net>; Sat, 25 Dec 2021 00:35:45 -0500 (EST) (envelope-from conor.williams@gmail.com) Received: from tb-mx0.topicbox.com (localhost [127.0.0.1]) by tb-mx0.topicbox.com (Authentication Milter) with ESMTP id 54789F59045; Sat, 25 Dec 2021 00:35:45 -0500 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1640410545; b=IzN0BfpMaKfY7fepWyuqV1Qmqy88PHtfjX4o6bF9mLGG/3bCNi vx0aPt/aXwxtVaU524eqgNaGoiz6B0aN45IrnA9q/WGo9z00ZXO9AmsCBmwqXhdj D44qmTAaffG6lXDKE8qWrflT3BwTQ5B+fiuH1ZbIMKI+JFfNIAwE8RZwXvKAxDY0 /NsHE7BMbpp4OO8H2xsQ/YUKWSlzjVhrd+EYUXL9mcYnP1MPUze+CUus6GjWTPGs LSGkuMaVfIq/J9gqA3Inyl660r9R04H+PIIJjWgw6XLPF/OGtTZYce8h/LU3lLPA KA4x3lpRxLTKHQ45R5XoqSsjvSzWDQE3/1bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=arcseal; t=1640410545; bh=882J5/e6zDE3LLr3LP2/GDinrY30t+8DXY9T1/sOg7E=; b=yLwFWki7Jse9 +hOeQkyZu3V51dcIlLmu9v49DZs9d9Q1zUK3LAg6FMX+UZd0s92ca+BR0tCnkSaM T87KunFlBVOEMUkJKyyjZicpPKpaDw3InZw9ccHRLR/WpxYt/50LHVgjcBOY0ikA +xY4zpyOMQGrlCbs46tL1qynaPBCctrxpvG3UANWHz7/KRdV0g7avVhm6Xz6mMC3 q5rp0eeA/U7jgYzLToiwTFRQgvg309ECwb8MRIOWrvZq8Rvc4Fo98MVYbHV/RiTX DcMc9PvDmqXnjmxhvXBzs8XqE347dkVlZ4zpJEuxDyZQlT/RhTfOedWCFiPntjsx A11KAZwn6w== ARC-Authentication-Results: i=1; tb-mx0.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=qw5ymROA header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.210.49 (mail-ot1-f49.google.com); spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f49.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=4kohpC0X; x-me-sender=none; x-ptr=pass smtp.helo=mail-ot1-f49.google.com policy.ptr=mail-ot1-f49.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt3.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt3.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvuddruddtledgvdekucdltddurdegudehrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgf nhhsuhgsshgtrhhisggvpdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttd enucenucfjughrpeggfhgjhfffkffuvfgtsegrtderredttdejnecuhfhrohhmpeevohhn ohhrucghihhllhhirghmshcuoegtohhnohhrrdifihhllhhirghmshesghhmrghilhdrtg homheqnecuggftrfgrthhtvghrnheptdetvedtgeelgfdvuddtheeitdegffehjeffleet jeetjeelveejgfeuhefhveehnecuffhomhgrihhnpehfrhgvvghshhgvlhhlrdhorhhgpd htohhpihgtsghogidrtghomhenucfkphepvddtledrkeehrddvuddtrdegleenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvtdelrdekhedrvddutddrge elpdhhvghlohepmhgrihhlqdhothduqdhfgeelrdhgohhoghhlvgdrtghomhdpmhgrihhl fhhrohhmpeeotghonhhorhdrfihilhhlihgrmhhssehgmhgrihhlrdgtohhmqe X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (gmail.com ... _spf.google.com: Sender is authorized to use 'conor.williams@gmail.com' in 'mfrom' identity (mechanism 'include:_netblocks.google.com' matched)) receiver=tb-mx0.topicbox.com; identity=mailfrom; envelope-from="conor.williams@gmail.com"; helo=mail-ot1-f49.google.com; client-ip=209.85.210.49 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx0.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Sat, 25 Dec 2021 00:35:45 -0500 (EST) (envelope-from conor.williams@gmail.com) Received: by mail-ot1-f49.google.com with SMTP id s21-20020a05683004d500b0058f585672efso8488537otd.3 for <9fans@9fans.net>; Fri, 24 Dec 2021 21:35:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=882J5/e6zDE3LLr3LP2/GDinrY30t+8DXY9T1/sOg7E=; b=4kohpC0XqN/6YBJWniaPRDXOLqEeOo6V20/uaLxDmTI7Q6tXtUVb9kkJTQnG2Cx71z MkJWRdjwhSV3DEaX0RFT6fXG8deabQqxCDIG17BS8mLft8YaH/iKP5SFoUVRNdKy3Mh4 cLgWjkq31CnQZPjxfzfCnbAbPP148/Er/lbWuzRnWX0Uj0MvtQM3Yuh+v/RbLgGcXPFJ W0d8C+og3WLla7yepwUh3YLb6dlEMBzlBsfx6VY1+nvRrigfrX6n3ZSZTE4no4aKmLeX ShJHvRIQOMkhxkes0jFqe6LJt9EtM/a9MTf5yDZbUXA154G6zqG7TEMIgIOnCKz+YHwf bPDg== X-Gm-Message-State: AOAM533Osk3nnQRYQi3YCuB7rO+9eANwG3/LvGC1X5HBl+tZy/YKoRtZ lwW2QLIZOO2fH1+Ya/6U0DsXXQaqyxzeSA7lHVYP3AvL X-Google-Smtp-Source: ABdhPJz52VH3Gbs0pbP3VgZz+MyDpvZgCCOAe5e4OGbiysv9CyJ8v9s42w2iBi00s1dY5E2PrWxT/nqF0FEdmtNAlDw= X-Received: by 2002:a9d:578c:: with SMTP id q12mr6727376oth.244.1640410544075; Fri, 24 Dec 2021 21:35:44 -0800 (PST) MIME-Version: 1.0 References: <171b6946-5a63-f723-b2c9-713ffcfea9e@SDF.ORG> In-Reply-To: <171b6946-5a63-f723-b2c9-713ffcfea9e@SDF.ORG> From: Conor Williams Date: Sat, 25 Dec 2021 05:35:31 +0000 Message-ID: Subject: Re: [9fans] Fix sam regexp bug with metacharacters in classes To: 9fans <9fans@9fans.net> Content-Type: multipart/alternative; boundary=000000000000c3f9b105d3f1d72b Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 84e362d4-6544-11ec-b548-bdef5e53d863 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UY2NiZGIyMGI2NzAwMDNhMS1NZGUxYzcxNGZkOWNhMWFmOWYzNDA3?= =?UTF-8?B?ZDhkPg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> Content-Transfer-Encoding: 7bit List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:Mde1c714fd9ca1af9f3407d8d:1:DXZuwfRd-Vc1EN3mg88Y5HYgfySui9zq2PrJMUNnju0 --000000000000c3f9b105d3f1d72b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable are u getting confused between Runemax and Runemask... I'm going to have my christmas dinner now ;; and reckon this patch would break a few things... i'm working off a mounted iso at the minute... it's handier: as in i have "-t iso9660" in it.. laters... /c:2021 crimbo hay ps: the jury is out on this one 'till after christmas but i'm not... pps: am i close?.. ppps: in bb vi a search for minus both ways works... ppps: should have an answer for you soon as to whether I would run with this patch On Tue, Nov 23, 2021 at 8:27 PM adr wrote: > The code assumes runes are 16 bits long, not 21, creating faulting > code parsing classes. I.e. '/[\-]' will not match '-'. >=20 > This is the same fix already in 9front. >=20 > http://adr.freeshell.org/plan9/patches/sam_fix_metachars_on_classes.diff >=20 > --- /sys/src/cmd/sam/regexp.c Tue Apr 23 19:06:01 2013 > +++ regexp.c Tue Nov 23 15:01:18 2021 > @@ -53,8 +53,8 @@ > /* > * Actions and Tokens > * > - * 0x100xx are operators, value =3D=3D precedence > - * 0x200xx are tokens, i.e. operands for operators > + * 0x2000xx are operators, value =3D=3D precedence > + * 0x3000xx are tokens, i.e. operands for operators > */ > enum { > OPERATOR =3D Runemask+1, /* Bitmask of all operators */ > @@ -462,7 +462,8 @@ > exprp++; > return '\n'; > } > - return *exprp++|(Runemax+1); > + /* add a flag so metacharacters aren't interpreted */ > + return *exprp++|(Runemask+1); > } > return *exprp++; > } > @@ -498,11 +499,12 @@ > if((c2 =3D nextrec()) =3D=3D ']') > goto Error; > classp[n+0] =3D Runemax; > - classp[n+1] =3D c1; > - classp[n+2] =3D c2; > + /* remove possible flag from nextrec() */ > + classp[n+1] =3D c1 & Runemask; > + classp[n+2] =3D c2 & Runemask; > n +=3D 3; > }else > - classp[n++] =3D c1; > + classp[n++] =3D c1 & Runemask; > } > classp[n] =3D 0; > if(nclass =3D=3D Nclass){ >=20 ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tccbdb20b670003a1-Mde1c7= 14fd9ca1af9f3407d8d Delivery options: https://9fans.topicbox.com/groups/9fans/subscription --000000000000c3f9b105d3f1d72b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
are u getting confused between Runemax and Run= emask...

I'm going to have my christmas dinner now= ;; and reckon this patch
would break a few things... i'm wor= king off a mounted iso at the minute...
it's handier: as in i= have "-t iso9660" in it..

laters...
/c:2021 crimbo hay
ps: the jury is out on this one '= till after christmas but i'm not...
pps: am i close?.. <= /div>
ppps: in bb vi a search for minus both ways works...
pp= ps: should have an answer for you soon as to whether I would run with this = patch


On Tue, Nov 23, 2021 at 8:27 PM adr <adr@sdf.org> wrote:
The code assumes runes are 16 bits l= ong, not 21, creating faulting
code parsing classes. I.e. '/[\-]' will not match '-'.

This is the same fix already in 9front.

http://adr.freeshell.org/plan9/patches/sam_fix_metac= hars_on_classes.diff

--- /sys/src/cmd/sam/regexp.c   Tue Apr 23 19:06:01 2013
+++ regexp.c    Tue Nov 23 15:01:18 2021
@@ -53,8 +53,8 @@
  /*
   * Actions and Tokens
   *
- *     0x100xx are operators, value =3D=3D precedence
- *     0x200xx are tokens, i.e. operands for operators
+ *     0x2000xx are operators, value =3D=3D precedence
+ *     0x3000xx are tokens, i.e. operands for operators
   */
  enum {
        OPERATOR =3D Runemask+1,  /* Bitmask of al= l operators */
@@ -462,7 +462,8 @@
                     = ;   exprp++;
                     = ;   return '\n';
                }
-               return *exprp++|(Ru= nemax+1);
+               /* add a flag so me= tacharacters aren't interpreted */
+               return *exprp++|(Ru= nemask+1);
        }
        return *exprp++;
  }
@@ -498,11 +499,12 @@
                     = ;   if((c2 =3D nextrec()) =3D=3D ']')
                     = ;           goto Error;
                     = ;   classp[n+0] =3D Runemax;
-                    &nbs= p;  classp[n+1] =3D c1;
-                    &nbs= p;  classp[n+2] =3D c2;
+                    &nbs= p;  /* remove possible flag from nextrec() */
+                    &nbs= p;  classp[n+1] =3D c1 & Runemask;
+                    &nbs= p;  classp[n+2] =3D c2 & Runemask;
                     = ;   n +=3D 3;
                }else
-                    &nbs= p;  classp[n++] =3D c1;
+                    &nbs= p;  classp[n++] =3D c1 & Runemask;
        }
        classp[n] =3D 0;
        if(nclass =3D=3D Nclass){


------------------------------------------
9fans: 9fans
Permalink: https:= //9fans.topicbox.com/groups/9fans/Tccbdb20b670003a1-M5d4e6bea6c6908b388e51f= 0c
Delivery options: https://9fans.topicbox.com/gro= ups/9fans/subscription
= --000000000000c3f9b105d3f1d72b--