From: Felipe Contreras <felipe.contreras@gmail.com>
To: arcnmx <arcnmx@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: BUG: ruby segfault in notmuch_rb_tags_each
Date: Wed, 22 Mar 2023 17:48:43 -0600 [thread overview]
Message-ID: <CAMP44s2M5bom9ewVu8-yBWVC2zfsm1HDAksm0Guxh9=jrFu-ZQ@mail.gmail.com> (raw)
In-Reply-To: <CABZgTerb6b9f1Jtc=17VDevz3bW6K=Q=eYqHu1cNnkf+3jqvgQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]
On Sat, Apr 30, 2022 at 5:09 PM arcnmx <arcnmx@gmail.com> wrote:
>
> Hi, I've been running into rare crashes via notmuch-vim for a while now and finally got around to tracking down the problem. I apologize for the size of the reproduction case, but at least it can be reproduced!
Thanks for the reproduction case, I setted up nix and indeed I was
able to reproduce the issue, I narrowed it down to a much simpler
test-case.
The problem is that Notmuch::Tags is mapped to notmuch_tags_t which in
the past was a standalone iterator, but later on could only be used
once, in particular I think this commit broke the assumption of the
Ruby bindings: d19c5de1 (Add the tag list to the unified message
metadata pass., 2010-12-09).
The code of notmuch-vim stores this tags iterable, traverses it, and
then afterwards tries to traverse it again, even after the original
parent (notmuch_message_t) might have been destroyed.
The crash can be reproduced in C with something like:
tags_0 = notmuch_message_get_tags(message);
// Store it for later
tags_1 = notmuch_message_get_tags(message);
// Traverse it
I've sent the patches that fix this in the Ruby bindings, but in the
meantime you can try this workaround in the Message constructor of
notmuch-vim:
@tags = msg.tags.map(&:to_s)
I'm attaching a simple script that reproduces the issue.
Cheers.
--
Felipe Contreras
[-- Attachment #2: simple.rb --]
[-- Type: application/x-ruby, Size: 329 bytes --]
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
prev parent reply other threads:[~2023-03-22 23:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-30 20:47 BUG: ruby segfault in notmuch_rb_tags_each arcnmx
2022-05-05 14:16 ` David Bremner
2023-03-22 23:50 ` Felipe Contreras
2023-03-22 23:48 ` Felipe Contreras [this message]
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMP44s2M5bom9ewVu8-yBWVC2zfsm1HDAksm0Guxh9=jrFu-ZQ@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=arcnmx@gmail.com \
--cc=notmuch@notmuchmail.org \
/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.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
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 read-only IMAP folder(s) and NNTP newsgroup(s).