Re: notmuch segfault
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 23 Apr 2010 13:37:59 +0000 (15:37 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:49 +0000 (09:36 -0800)
a2/9ab39b39ce1eabdb2ad7377415b664f0751ab3 [new file with mode: 0644]

diff --git a/a2/9ab39b39ce1eabdb2ad7377415b664f0751ab3 b/a2/9ab39b39ce1eabdb2ad7377415b664f0751ab3
new file mode 100644 (file)
index 0000000..a33cfad
--- /dev/null
@@ -0,0 +1,91 @@
+Return-Path: <sojkam1@fel.cvut.cz>\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 41C104196F2\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 06:38:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\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 p-49Xfk77QhH for <notmuch@notmuchmail.org>;\r
+       Fri, 23 Apr 2010 06:38:05 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 56ED5431FC1\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 06:38:05 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 4B2E019F33D6;\r
+       Fri, 23 Apr 2010 15:38:04 +0200 (CEST)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+       by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+       port 10044)\r
+       with ESMTP id rCm5xrhbu0B2; Fri, 23 Apr 2010 15:38:00 +0200 (CEST)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 9F6DE19F332E;\r
+       Fri, 23 Apr 2010 15:38:00 +0200 (CEST)\r
+Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id 8B83DFA003;\r
+       Fri, 23 Apr 2010 15:38:00 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.71)\r
+       (envelope-from <sojkam1@fel.cvut.cz>)\r
+       id 1O5J4x-0003vq-9l; Fri, 23 Apr 2010 15:37:59 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: Sebastian Spaeth <Sebastian@SSpaeth.de>,\r
+       Notmuch development list <notmuch@notmuchmail.org>\r
+Subject: Re: notmuch segfault\r
+In-Reply-To: <87d3xqti3o.fsf@SSpaeth.de>\r
+References: <8739ym4mxk.fsf@SSpaeth.de> <87d3xqti3o.fsf@SSpaeth.de>\r
+Date: Fri, 23 Apr 2010 15:37:59 +0200\r
+Message-ID: <87sk6m2sso.fsf@steelpick.2x.cz>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Fri, 23 Apr 2010 13:38:06 -0000\r
+\r
+On Fri, 23 Apr 2010, Sebastian Spaeth wrote:\r
+> Can it be that in thread.cc in _thread_add_matched_message ()\r
+> ...\r
+>     subject = notmuch_message_get_header (message, "subject");\r
+> \r
+>     if ((strncasecmp (subject, "Re: ", 4) == 0) ||\r
+> ...\r
+> \r
+> If the underlying message disappeared, get_header will return NULL and\r
+> we pass strncasecmp NULL as first parameter. Could that be?\r
+\r
+Yes, it is very likely the problem. The fix is obvious (see bellow), but\r
+the question is how will be this "missing message" presented to the user\r
+e.g. in notmuch show. It may be that we will need some other checks to\r
+not break other things.\r
+\r
+diff --git a/lib/thread.cc b/lib/thread.cc\r
+index 5bf8354..29b8336 100644\r
+--- a/lib/thread.cc\r
++++ b/lib/thread.cc\r
+@@ -148,6 +148,9 @@ _thread_add_matched_message (notmuch_thread_t *thread,\r
\r
+     subject = notmuch_message_get_header (message, "subject");\r
\r
++    if (!subject)\r
++       return;\r
++\r
+     if ((strncasecmp (subject, "Re: ", 4) == 0) ||\r
+        (strncasecmp (subject, "Aw: ", 4) == 0) ||\r
+        (strncasecmp (subject, "Vs: ", 4) == 0) ||\r