From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/105806 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: luigi scarso Newsgroups: gmane.comp.tex.context Subject: Re: Bug: Segmentation fault Date: Wed, 11 Dec 2019 09:48:57 +0100 Message-ID: References: <74c2c2df-8a8d-d742-ae23-dd0b61803fbf@gmail.com> <0d62a24a-a8a1-e7e2-674e-8ec33681bd5f@xs4all.nl> <6bf2d70c-b606-3833-8b91-6c84607c0f53@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0531536626923872160==" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="116671"; mail-complaints-to="usenet@blaine.gmane.org" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Dec 11 09:49:35 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iexgd-000UCH-8H for gctc-ntg-context-518@m.gmane.org; Wed, 11 Dec 2019 09:49:35 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 68C11163D9B; Wed, 11 Dec 2019 09:49:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dm44a3IBNSgY; Wed, 11 Dec 2019 09:49:11 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 90582163EEB; Wed, 11 Dec 2019 09:49:11 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8D047163D9B for ; Wed, 11 Dec 2019 09:49:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EJQd4GPKg9vc for ; Wed, 11 Dec 2019 09:49:10 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.208.180; helo=mail-lj1-f180.google.com; envelope-from=luigi.scarso@gmail.com; receiver= Original-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id E6116163D93 for ; Wed, 11 Dec 2019 09:49:09 +0100 (CET) Original-Received: by mail-lj1-f180.google.com with SMTP id a13so23082476ljm.10 for ; Wed, 11 Dec 2019 00:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=zlsBTvKM6qRE5dd0jwaayF12TRsrjynsQk239NSDrqs=; b=Vi47UpGcceiwvEpD9NLFaLUsG05Yx+l2UcuGDFoVSUDfUwTnTDBbu1Mc7yV96OpbQF bICwJQNKSVy4UXiOgWMNOOyFto99hmN7hrtQ6mWSxW3xWPTkw+YQ5Wd14znmH91s71w0 l43D0rkGs0AtaQNGDr3sKi6SlfQdxocHPV0iMDcIOfrD1KRnGyM1oL5HMkukyjk8JaZX Pw7OEUdD1mLgkvg96KKBL6IVqIeXrlKsf036miwhDKIyNuNm22f+GJzkgY2Hn8Ys7fM1 hmoTCySlzwwbm7G28w7Ar6QBe1TKg0RYuwRMG1nL/7NaMa2DKA7+cQY5U272usw7zeB8 pwHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=zlsBTvKM6qRE5dd0jwaayF12TRsrjynsQk239NSDrqs=; b=qpkIAihQWMkXIo7JzJtAKBZiSwoPoI51sAV4H98bVl8bOmlgaBoGJU7GZKh4dks4YZ Q3HQ2Cy9+qsTj6YZkz+ICPH4+Yp+U6USKAU9pNe2WOzp7sxN1ChkG2yi4FPc7Y5ihRAZ 9ceER7CPwre9lc5gTZuJl92koKyAZQ4VTf8NFjOdQOEwHUIVuHbWwkMkxOgdZSSjm3/o tVewqoF8zogTFsBmUqcPRMFNOzuNH9YcsQI5lhPHZKRtn7V2j+Vn9ggUrqepVOt19aBd xmyb+RmBJt6eU/xwJYBqxowwDkY3FgKxfiWsvBxQlv5RSapcZzNyraVFsWcTV8UOx40p l5Qw== X-Gm-Message-State: APjAAAViMVQYH1DZJkUvH+LgnR1mWwkbFEeEbegJ9JIH4sAonLcu/9ib nykV32lMIKw7rAKYhgvWR2SV33VN1Sfa101IsKlYR+VSLdA= X-Google-Smtp-Source: APXvYqwfZoyCoHnoML74oeU5U/RzifDP7LF2NQjtaCwRydxKtmTDH457noI+TxRD59j9W4mmBT5dEm8KRfpWUrnDLds= X-Received: by 2002:a2e:8152:: with SMTP id t18mr1210266ljg.255.1576054148749; Wed, 11 Dec 2019 00:49:08 -0800 (PST) In-Reply-To: <6bf2d70c-b606-3833-8b91-6c84607c0f53@gmail.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:105806 Archived-At: --===============0531536626923872160== Content-Type: multipart/alternative; boundary="000000000000aedc46059969b32e" --000000000000aedc46059969b32e Content-Type: text/plain; charset="UTF-8" On Wed, Dec 11, 2019 at 1:28 AM Henri Menke wrote: > In this case I wanted to generate the thin space (\,). My expectation > (which worked elsewhere) was that full expansion will turn "\string\\," > into "\\," where the two backslashes have catcode 12 and will not be > expanded further. Then the Lua string will turn the escape sequence \\ > into a single backslash, therefore ending up with \, in the Lua string. > > \directlua{token.set_macro("foo","\relax")} (gdb) x/7c str 0x555559376c18: 13 '\r' 101 'e' 108 'l' 97 'a' 120 'x' 32 ' ' 0 '\000' (gdb) p lstr $24 = 6 where \foo is \foo=macro: ->#!. vs \directlua{token.set_macro("foo",[==[\relax]==])} (gdb) x/8c str 0x555559376ea8: 92 '\\' 114 'r' 101 'e' 108 'l' 97 'a' 120 'x' 32 ' ' 0 '\000' (gdb) p lstr $25 = 7 \foo=macro: ->\relax . Another example is \directlua{token.set_macro("foo","\medskip")}\show\foo which gives the error: invalid escape sequence near '"^^Kskip \m'. vs \directlua{token.set_macro("foo",[==[\medskip]==])}\show\foo which gives \foo=macro: ->\vskip \medskipamount . Your example: \directlua{token.set_macro("foo","\string\\,")}\show\foo gives (gdb) x/3c str 0x5555593765a8: 92 '\\' 44 ',' 0 '\000' (gdb) p lstr $29 = 2 \foo=macro: ->BAD,. vs \directlua{token.set_macro("foo",[==[\,]==])}\show\foo (gdb) x/20c str 0x555559376908: 92 '\\' 109 'm' 115 's' 107 'k' 105 'i' 112 'p' 32 ' ' 92 '\\' 0x555559376910: 116 't' 104 'h' 105 'i' 110 'n' 109 'm' 117 'u' 115 's' 107 'k' 0x555559376918: 105 'i' 112 'p' 32 ' ' 0 '\000' (gdb) p lstr $31 = 19 \foo=macro: ->\mskip \thinmuskip . -- luigi --000000000000aedc46059969b32e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Dec 11, 2019 at 1:28 AM Henri= Menke <henrim= enke@gmail.com> wrote:
In this case I wanted to generate the thin space (\,).=C2=A0 = My expectation
(which worked elsewhere) was that full expansion will turn "\string\\,= "
into "\\," where the two backslashes have catcode 12 and will not= be
expanded further.=C2=A0 Then the Lua string will turn the escape sequence \= \
into a single backslash, therefore ending up with \, in the Lua string.
=


<= br>
\directlua{token.set_macro("foo","\relax"= )}
(gdb) x/7c str
0x555559376c18: 13 '\r' 101 '= ;e' 108 'l' 97 'a' =C2=A0120 'x' 32 ' '= =C2=A00 '\000'
(gdb) p lstr
$24 =3D 6
where \foo is=C2=A0=
=C2=A0\foo=3Dmacro:
->#!.

vs
\directlua{token.set_macro("foo",[=3D=3D[\relax]=3D=3D])}
<= /div>
(gdb) x/8c str
0x555559376ea8: 92 '\\' 114 'r'= 101 'e' 108 'l' 97 'a' =C2=A0120 'x' 32 &#= 39; ' =C2=A00 '\000'
(gdb) p lstr
$25 =3D 7
\foo=3Dmacro:
->\relax .

Another exampl= e is=C2=A0
\directlua{token.set_macro("foo","\meds= kip")}\show\foo=C2=A0=C2=A0
which gives the error:=C2=A0 =C2= =A0invalid escape sequence near '"^^Kskip \m'.
vs
\directlua{token.set_macro("foo",[=3D=3D[\medskip]=3D=3D]= )}\show\foo
=C2=A0which gives=C2=A0
\foo=3Dmacro:->\vskip \medskipamount .

Your exam= ple:
\directlua{token.set_macro("foo","\string\\,&= quot;)}\show\foo=C2=A0
gives
(gdb) x/3c str
0x55= 55593765a8: 92 '\\' 44 ',' =C2=A00 '\000'
(gdb) = p lstr
$29 =3D 2
=C2=A0\foo=3Dmacro:
->BAD,.

vs
\directlua{token.set_macro("foo&quo= t;,[=3D=3D[\,]=3D=3D])}\show\foo
(gdb) x/20c str
0x5555593= 76908: 92 '\\' 109 'm' 115 's' 107 'k' 105 = 'i' 112 'p' 32 ' ' =C2=A092 '\\'
0x55555= 9376910: 116 't' 104 'h' 105 'i' 110 'n' 10= 9 'm' 117 'u' 115 's' 107 'k'
0x55555937= 6918: 105 'i' 112 'p' 32 ' ' =C2=A00 '\000'=
(gdb) p lstr
$31 =3D 19
=C2=A0\foo=3Dmacro:
->\mskip = \thinmuskip .


--
luigi
--000000000000aedc46059969b32e-- --===============0531536626923872160== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============0531536626923872160==--