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_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2251 invoked from network); 24 Nov 2021 01:29:58 -0000 Received: from tb-ob1.topicbox.com (64.147.108.173) by inbox.vuxu.org with ESMTPUTF8; 24 Nov 2021 01:29:58 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob1.topicbox.com (Postfix) with ESMTP id C4B2224A0A for ; Tue, 23 Nov 2021 20:29:56 -0500 (EST) (envelope-from bounce.mM5540075cb6bb20848c0e586d.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id BEE0A790514; Tue, 23 Nov 2021 20:29: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=Qe7x+46q 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 (body 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=1637717396; bh=RqJ08cpevUSS3F5C j5pRiIgTDSpIoq3zn96Vnm2+fqQ=; b=S/g5t2BhPYzCGdDo6dK9c5ocX65zEDpx 1xXeRjKe8kn3yZiTSI5VoUemfn3hZ517FHZ8K3rRkBeb9XI+IwgRr1vpn51CzLcO Dx1Y9B8YFLyCtoFVIiLK1GRv5R7zYK8vCuRCiLigrV2m7/9loCrbLtG8p/vNL+lF qNN9MWAg4h4= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1637717396; b=B/HydK3rTKW7GuaT71dzzkra9KcBQnKL6+qSlC1EWofn2k+XIj 463PJkrQL9iuq2eBciKGn0dn5HZQNY8Auu2wwRSsM/7cub2iJ/Mx0NgHYCVZCpbR emHaHPC9rlWURhZkOevatyY/obdujqQKxmGj1lZDaFxXvwH4KaKRUI9Ps= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=Qe7x+46q 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 (body has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx1.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=Qe7x+46q 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=TljopkMu; 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: alt1.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt1.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,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=ggeGWKJa70Zhp2aJsyW2xlQOd90EmWCL9dEpsf3wcAI=; b=DIaD4MVAA05G 6lHIU0BmeXA6tCLez4OYddPnyJHWxz9Rt/WAz3VVsf0VZxiGOo3B7n6lRLOAGgCn GA2YtYQ6jC+rynZSwONiW9KUqf8Vg8+Nu1WKNZx0blDmn8AtsNwqPjZMA/z4Kw6N IaAzMe4mdiokz9kDhQdWBXWAaZ+sikY= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 00B9D861E2D for <9fans@9fans.net>; Tue, 23 Nov 2021 20:29:47 -0500 (EST) (envelope-from conor.williams@gmail.com) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id 26F16BD4667; Tue, 23 Nov 2021 20:29:46 -0500 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1637717386; b=Xo2j4CL+WOxcxHvJMK4rwkM29X9vfAHLYug6WrOUfX2rtBL6Br QfiYZdwFnUVhljL3DF1tpKoqfRCq0J1tZq8BDe0NFOkx3lANAwSouhXGxZui068M adUUAw6LF65ax5NcdvmZAZ3v/b+EEqGKXNhg4yLlzfMokU/OC3ejB68dZejznhx9 p9NHOnG7OQW0LABdBJ1+mX9xSlHjMZtHv59I4q/9oTLaRXSGonfMnOLGFWWS550y /+5pAHeVFehvVelB+fqIyAw8zFeZhogisQz5oJRdDN4O6a/n/CVhZYM/DPliTxZS oyC8ILnV952aopt5FAjZlJa6VpTVnB+pBkrg== 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=1637717386; bh=pEdXOb0e4wQSigsm62nxWEnPKDAAIaI6qKxvfkYaICw=; b=NVZ6C9lLO3GF 85V0kRaqA2TjxB656Y4/6B6KHHUD2+8eBicfE/3+hr+z+bEH4N0ORtU/qYcuA30B GB9yBnTecthkYKNTqf+objaEDPVOCLkDuXAG24AcsUT5cieDcJ2TjFnB2r9brwd0 Tl9DgZGdpWc6Eq9PPA33i3NuNkG5hJSTbzUz9O5pIhof0Acz6TOFkspM0bDJzR3i MzOg1F3ERBmVfYh6B/Ro+4KGQAT57aElj6rmHi2tzLwwW903vyV0IXLObVgEgi2S VlzOEGi0LSB9qkK+RpjfcPfE6zCM/z5tD4CLUDJsKN4zF9X2w3joKWZGVVr5+K8B LvO5ZgzzUg== ARC-Authentication-Results: i=1; tb-mx1.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=Qe7x+46q 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=TljopkMu; 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: alt1.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt1.gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,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: gggruggvucftvghtrhhoucdtuddrgedvuddrgedtucdltddurdegudelrddttddmucetuf doteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgs shgtrhhisggvpdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenuc fjughrpeggfhgjhfffkffuvfgtsegrtderredttdejnecuhfhrohhmpeevohhnohhrucgh ihhllhhirghmshcuoegtohhnohhrrdifihhllhhirghmshesghhmrghilhdrtghomheqne cuggftrfgrthhtvghrnheptdetvedtgeelgfdvuddtheeitdegffehjeffleetjeetjeel veejgfeuhefhveehnecuffhomhgrihhnpehfrhgvvghshhgvlhhlrdhorhhgpdhtohhpih gtsghogidrtghomhenucfkphepvddtledrkeehrddvuddtrdegleenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepihhnvghtpedvtdelrdekhedrvddutddrgeelpdhhvg hlohepmhgrihhlqdhothduqdhfgeelrdhgohhoghhlvgdrtghomhdpmhgrihhlfhhrohhm peeotghonhhorhdrfihilhhlihgrmhhssehgmhgrihhlrdgtohhmqe 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-mx1.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-mx1.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Tue, 23 Nov 2021 20:29:46 -0500 (EST) (envelope-from conor.williams@gmail.com) Received: by mail-ot1-f49.google.com with SMTP id a23-20020a9d4717000000b0056c15d6d0caso1617185otf.12 for <9fans@9fans.net>; Tue, 23 Nov 2021 17:29: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=pEdXOb0e4wQSigsm62nxWEnPKDAAIaI6qKxvfkYaICw=; b=TljopkMu4msd1JhscfHs55UpkL/b+7/76huHYOe7+QmLw6jLekSWcCF1CmRMIAMQQ/ sGdxE2mOZtw6DjfRUJaEwAnx9Srze8mzor9XZsJ7FYqFeIN2pE/ZFmlprO0bGAPIMziW BbezhnXx8ixWy+yH2yQ738MZdqigy5X7eYWd46545kiOWS9VA6vZdXQIiYVrO8cm+R9z McnRwL3vvnNfyvV6eZRc11OYr+RKr27JZuQcOQLHTDBqkR4tLEgf0QzZGFUiBbNRSBhV OO4t/lwEQcuh6PCbbbXAfn0ZzSmsGCemyiHdrEIwUf4YtrMKXppwaFFFNxCPw3SlqytM PPRQ== X-Gm-Message-State: AOAM531HDgoy0YvFzy+jKQMdPsmR5XpXLVGGyXQCpR/3A+18JimU7T6u n2kx8led+0xzr1Jez4OD3TN+x7Y+5YuqEGBSYGtHosCdHiE= X-Google-Smtp-Source: ABdhPJwODxjQiaqA5C18ilGeUk9M7N03vmXp8BPZ30PF1bfB6a8kxADQqim5nyUhkXK2hEa7ZjhCDP3GGFPY2Daq0AE= X-Received: by 2002:a9d:71dc:: with SMTP id z28mr9190536otj.244.1637717384997; Tue, 23 Nov 2021 17:29:44 -0800 (PST) MIME-Version: 1.0 References: <171b6946-5a63-f723-b2c9-713ffcfea9e@SDF.ORG> In-Reply-To: From: Conor Williams Date: Wed, 24 Nov 2021 01:29: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="000000000000f9b00f05d17ecae2" Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 054c9d06-4cc6-11ec-a64e-c498f349c617 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UY2NiZGIyMGI2NzAwMDNhMS1NNTU0MDA3NWNiNmJiMjA4NDhjMGU1?= =?UTF-8?B?ODZkPg==?= 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:M5540075cb6bb20848c0e586d:1:DhH6Silid_ZIwfe6lVzK9xY5yFVkfEltbrGCS9P0qJ0 --000000000000f9b00f05d17ecae2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable sorry that s should have a k preceding _ /c:2021248pm On Wed, Nov 24, 2021 at 1:28 AM Conor Williams wrote: > why on Gaia do you not have a > Runemas_Incremented_By_One_To_Keep_A_Negative_Sub > variable? > apart from that, it looks okay... will tango it in later... > > /c:2022November!^N^M > > 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-M55400= 75cb6bb20848c0e586d Delivery options: https://9fans.topicbox.com/groups/9fans/subscription --000000000000f9b00f05d17ecae2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
sorry that s should have a k preceding _ /c:20= 21248pm

On Wed, Nov 24, 2021 at 1:28 AM Conor Williams <conor.williams@gmail.com> wrote= :
why on Gaia do you not have a Runemas_Incremented_By_One_To_Keep_= A_Negative_Sub
variable?
apart from that, it looks okay= ... will tango it in later...

/c:2022November!^N= ^M

On Tue, Nov 23, 2021 at 8:27 PM adr <adr@sdf.org> wrote:
The code assumes runes are 16 bi= ts long, 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
= --000000000000f9b00f05d17ecae2--