[neomutt-devel] Lua in neomutt | systematically finding segmentation faults

Richard Russon rich at flatcap.org
Wed Mar 3 17:13:29 CET 2021


Hi toogley,

> i think Lua bindings are of no use at the moment and could be removed.

They _could_ be, but I'm not going to do that.

Lua has about 360 lines of code.
It's stable and has very light dependencies in the code
(i.e. very few `#ifdef USE_LUA`)

I agree, it doesn't *do* much, but some people are using it
and importantly it doesn't make anything unstable.

> So neomutt has a few quite complicated things,
> for instance index_format

Yes, this *is* complicated, but not for the visible reasons.
The code to expand the %'s is fiendishly complicated and introduces some
ugly dependencies in the code.

> these things are not that readable
> lua bindings this could be made more readable.

One way to make them more legible would be to make them more verbose:

    %{author} %{subject}

> Such index_formats are hard to write but i think readability is not so
> important as you don't edit it probably that often.

Possibly.  But the code still needs an overhaul.

> i think it is better to spend that on other parts of neomutt, for
> instance the refactoring.

Yes

> OpenBSD is more strict about memory errors

Hmm...
The Address Sanitizer and Valgrind are very strict (whatever the OS).

> We could rent a builds.sr.ht machine

Well that's very kind, if you're paying :-)

> and configure it so it runs with every pull request

We already have CI running tests.

> complicated neomutt configs and see if it crashes.

It's very hard to automate NeoMutt and the complexity of the code limits
our ability to unit-test many functions.

We're working on it, but for a couple of small problems:

- 'We' is generally just me
  Few people understand the code
  Fewer still have the time to do anything about it

- Making NeoMutt modular, so that it could be tested is VERY HARD

> If it crashes, builds.sr.ht provides the ability to SSH into the build VM.

That's a very nice feature.
But I'm still not paying for it.

> We could also try to start a mail server on localhost and send mails
> with those complicated neomutt configs and see if it crashes.

Good idea, but that's a lot of work to set up.
You'll need a virtual machine, say Docker, and a very careful mail server setup.
And then lots of time to set up these complicated test scenarios.

> But unfortunately i don't have time

Therein lies the problem.

Cheers,
    Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mailman.neomutt.org/pipermail/neomutt-devel-neomutt.org/attachments/20210303/80c3c30d/attachment.sig>


More information about the neomutt-devel mailing list