--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0116A431FD9\r
+ for <notmuch@notmuchmail.org>; Tue, 24 Mar 2015 02:34:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+ tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id mgLSyH5o7bcz for <notmuch@notmuchmail.org>;\r
+ Tue, 24 Mar 2015 02:34:01 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id DF2AA431FD2\r
+ for <notmuch@notmuchmail.org>; Tue, 24 Mar 2015 02:34:00 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 07F9A100086;\r
+ Tue, 24 Mar 2015 11:33:36 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Simon Campese <notmuchmail_org@campese.de>, notmuch@notmuchmail.org\r
+Subject: Re: [BUG] notmuch crashes on FreeBSD when synchronize_flags=true\r
+In-Reply-To: <87bnjmi5ff.fsf@maritornes.cs.unb.ca>\r
+References: <86619utwz5.fsf@tu-dortmund.de>\r
+ <87bnjmi5ff.fsf@maritornes.cs.unb.ca>\r
+User-Agent: Notmuch/0.19+92~g61c04e8 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Tue, 24 Mar 2015 11:33:35 +0200\r
+Message-ID: <m2iodqzqmo.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 24 Mar 2015 09:34:05 -0000\r
+\r
+\r
+FYI (VirtualBox FreeBSD_10.1-64bit.7z from http://www.osboxes.org/freebsd/)\r
+ \r
+ root@osboxes:~/mail # rm -rf .notmuch/\r
+ root@osboxes:~/mail # notmuch new\r
+ Found 1 total files (that's not much mail).\r
+ Warning: /root/mail/new/new.mail is an mbox containing a single message,\r
+ likely caused by misconfigured mail delivery. Support for single-message\r
+ mboxes is deprecated and may be removed in the future.\r
+ Abort (core dumped)\r
+\r
+Built latest HEAD (bed8b6743) in $HOME/sw/notmuch\r
+\r
+ root@osboxes:~/mail # rm -rf .notmuch/\r
+ root@osboxes:~/mail # ~/sw/notmuch/notmuch new\r
+ Found 2 total files (that's not much mail).\r
+ Note: Ignoring non-mail file: /root/mail/notmuch.core\r
+ Processed 2 total files in almost no time.\r
+ Added 1 new message to the database.\r
+ root@osboxes:~/mail #\r
+\r
+OK, what worked :O (statically linked libnotmuch.4). Wat about shared...\r
+\r
+ root@osboxes:~/mail # rm -rf .notmuch/ notmuch.core\r
+ root@osboxes:~/mail # env LD_LIBRARY_PATH=$HOME/sw/notmuch/lib $HOME/sw/notmuch/notmuch-shared new\r
+ Found 1 total files (that's not much mail).\r
+ Abort (core dumped)\r
+\r
+ root@osboxes:~/mail # gdb $HOME/sw/notmuch/notmuch-shared notmuch-shared.core\r
+ GNU gdb 6.1.1 [FreeBSD]\r
+ ...\r
+ Core was generated by `notmuch-shared'.\r
+ Program terminated with signal 6, Aborted.\r
+ Reading symbols from /root/sw/notmuch/lib/libnotmuch.so.4...done.\r
+ ...\r
+ [New Thread 804406400 (LWP 100071/notmuch-shared)]\r
+(gdb) bt\r
+#0 0x00000008018d46ca in thr_kill () from /lib/libc.so.7\r
+#1 0x00000008019a9149 in abort () from /lib/libc.so.7\r
+#2 0x00000008022e242d in __cxa_rethrow () from /lib/libcxxrt.so.1\r
+#3 0x0000000801c5d7d6 in Xapian::Document::Internal::remove_term ()\r
+ from /usr/local/lib/libxapian.so.22\r
+#4 0x00000008008500bc in _notmuch_message_remove_term\r
+ (message=0x804468780, \r
+ prefix_name=0x800858414 "tag", value=<value optimized out>)\r
+ at message.cc:1146\r
+#5 0x000000080085158f in notmuch_message_remove_tag (message=0x804468780, \r
+ tag=0x800859167 "draft") at message.cc:1205\r
+#6 0x0000000800851795 in notmuch_message_maildir_flags_to_tags (\r
+ message=<value optimized out>) at message.cc:1312\r
+#7 0x000000000040d9e5 in add_files (notmuch=0x8044542a0, \r
+ path=0x80445a3b0 "/root/mail/new", state=0x7fffffffe8b0)\r
+ at notmuch-new.c:272\r
+#8 0x000000000040d448 in add_files (notmuch=0x8044542a0, \r
+ path=0x804459fc0 "/root/mail", state=0x7fffffffe8b0) at\r
+ notmuch-new.c:477\r
+#9 0x000000000040c85f in notmuch_new_command (config=0x804468160, \r
+ argc=<value optimized out>, argv=<value optimized out>)\r
+ at notmuch-new.c:1070\r
+#10 0x0000000000408a23 in main (argc=<value optimized out>, \r
+ argv=0x7fffffffeb18) at notmuch.c:353\r
+\r
+Due to just quick testing forgot my suggestion for CFLAGS... so...\r
+\r
+ 143 7:27 cd\r
+ 144 7:27 cd sw/notmuch\r
+ 145 7:27 make distclean\r
+ 146 7:28 gmake distclean\r
+ 147 7:28 env CFLAGS='-ggdb -O0' ./configure\r
+ 148 7:28 make\r
+ 149 7:28 gmake\r
+ 151 7:29 cd\r
+ 152 7:29 cd mail/\r
+ 153 7:29 ls\r
+ 154 7:29 rm notmuch-shared.core\r
+ 155 7:29 env LD_LIBRARY_PATH=$HOME/sw/notmuch/lib $HOME/sw/notmuch/notmuch-shared new\r
+ 156 7:29 gdb $HOME/sw/notmuch/notmuch-shared notmuch-shared.core\r
+\r
+(gdb) bt\r
+#0 0x00000008018f26ca in thr_kill () from /lib/libc.so.7\r
+#1 0x00000008019c7149 in abort () from /lib/libc.so.7\r
+#2 0x000000080230042d in __cxa_rethrow () from /lib/libcxxrt.so.1\r
+#3 0x0000000801c7b7d6 in Xapian::Document::Internal::remove_term ()\r
+ from /usr/local/lib/libxapian.so.22\r
+#4 0x00000008008668b3 in _notmuch_message_remove_term\r
+(message=0x804468780, \r
+ prefix_name=0x800874151 "tag", value=0x800874e97 "draft") at\r
+ message.cc:1146\r
+#5 0x0000000800868f76 in notmuch_message_remove_tag (message=0x804468780, \r
+ tag=0x800874e97 "draft") at message.cc:1205\r
+#6 0x00000008008691d3 in notmuch_message_maildir_flags_to_tags (\r
+ message=0x804468780) at message.cc:1312\r
+#7 0x0000000000411295 in add_file (notmuch=0x8044542a0, \r
+ filename=0x80445c6e0 "/root/mail/new/new.mail", state=0x7fffffffe8b8)\r
+ at notmuch-new.c:272\r
+#8 0x00000000004102e2 in add_files (notmuch=0x8044542a0, \r
+ path=0x80445a3b0 "/root/mail/new", state=0x7fffffffe8b8)\r
+ at notmuch-new.c:587\r
+#9 0x000000000040fdad in add_files (notmuch=0x8044542a0, \r
+ path=0x804459fc0 "/root/mail", state=0x7fffffffe8b8) at\r
+ notmuch-new.c:477\r
+#10 0x000000000040ee81 in notmuch_new_command (config=0x804468160, argc=1, \r
+ argv=0x7fffffffeb20) at notmuch-new.c:1070\r
+#11 0x0000000000409277 in main (argc=2, argv=0x7fffffffeb18) at\r
+notmuch.c:353\r
+\r
+Tomi\r
+\r