I've been attempting to port nmweb to the new bindings, but I got stuck
on a bug that segfaults python. I attached a reduced version that
reproduces the problem for me. It uses recent messages from the notmuch
list; it others can't reproduce let me know and I will try to make
something more self contained including a message set.

It's a bit tricky to get ASAN working but I managed with

% env ASAN_OPTIONS=alloc_dealloc_mismatch=0 LD_PRELOAD="libasan.so.6 
libstdc++.so.6" LD_LIBRARY_PATH=../../lib python3 ~/test.py

You can see in the attached output that one of the notmuch messages
structs is used after being freed. I suspect it has something to do with
the iterator code in the bindings, but I have not examined it in detail.

from notmuch2 import Database

def mailto_addrs(msg,header_name):
    hdr = msg.header(header_name)

def show_msgs(msgs):
  print("show msgs" + str(msgs))
  for msg in msgs:
      frm = mailto_addrs(msg,'From')
      rs = show_msgs(msg.replies())

db = Database(config=Database.CONFIG.SEARCH)
threads = db.threads(query="thread:"+msg.threadid)
thread = next (threads)


Attachment: asan.out
Description: Binary data

notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to