ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henri Menke <henrimenke@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Bug: Segmentation fault
Date: Wed, 11 Dec 2019 13:28:04 +1300	[thread overview]
Message-ID: <6bf2d70c-b606-3833-8b91-6c84607c0f53@gmail.com> (raw)
In-Reply-To: <CAG5iGsCA1ix5+9YcKB9Z5tT11zX02OdFetavGQFXm1ByHds9Rw@mail.gmail.com>

On 12/11/19 12:23 PM, luigi scarso wrote:
> On Wed, Dec 11, 2019 at 12:10 AM Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
>> On 12/11/2019 12:03 AM, luigi scarso wrote:
>>>
>>>
>>> On Tue, Dec 10, 2019 at 9:27 PM Henri Menke <henrimenke@gmail.com
>>> <mailto:henrimenke@gmail.com>> wrote:
>>>
>>>      Dear devs,
>>>
>>>      The example below crashes LuaTeX with a segmentation fault.  It is
>>>      reproducible
>>>      with LuaTeX 1.10.1 7143 and LuaTeX 1.11.2 7226.  To this end I built
>>>      7226 from
>>>      source with --debugopt to get a backtrace, which can be found below
>>>      as well.
>>>
>>>      Cheers, Henri
>>>
>>>      ---
>>>
>>>      \directlua{token.set_macro(-1, "foo","\string\\,")}
>>>      \show\foo
>>>      \foo
>>>      \bye
>>>
>>>
>>> I guess that we have to check if catcodetable -1 is already defined...
>> i already sent you a patch, probbaly also ok for trunk
>>
> 
> 
> yes, seen
> 
> 
> 
>> but one needs to be careful as fo rinstance \string\foo is seen as
>> <formfeed>oo so often one also needs to escape properly
>>
> 
>   I always start with  [==[ ... ]==]  ie
> \directlua{token.set_macro(-1, [==[foo]==],[==[\string\\,]==])}
>   gdb reports this [==[\string\\,]==] string as
>   "\\\\,"
> which is an array of char of length 3 ie {'\\','\\',','}
> 
> With \directlua{token.set_macro(-1, [==[foo]==],"\string\\,")}
> gdb reports "\\,"
> ie {'\\','\,'}
> 
> I always check which one is the correct one...

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.
Demo below.

Cheers, Henri


$ luatex <(echo '\relax\directlua{print("\string\\,")}\bye')
This is LuaTeX, Version 1.11.2 (TeX Live 2020/dev)
  restricted system commands enabled.
(/dev/fd/63\,
)
warning  (pdf backend): no pages of output.
Transcript written on 63.log.

> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2019-12-11  0:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 20:26 Henri Menke
2019-12-10 20:36 ` luigi scarso
2019-12-10 22:36 ` Hans Hagen
2019-12-10 23:03 ` luigi scarso
2019-12-10 23:10   ` Hans Hagen
2019-12-10 23:23     ` luigi scarso
2019-12-11  0:28       ` Henri Menke [this message]
2019-12-11  8:48         ` luigi scarso
2019-12-11  9:11         ` Hans Hagen
2019-12-11 10:57     ` luigi scarso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bf2d70c-b606-3833-8b91-6c84607c0f53@gmail.com \
    --to=henrimenke@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).