--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 378ED431FD0\r
+ for <notmuch@notmuchmail.org>; Tue, 27 Sep 2011 15:44:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 zbLoGS8DCh85 for <notmuch@notmuchmail.org>;\r
+ Tue, 27 Sep 2011 15:44:03 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 99249431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 27 Sep 2011 15:44:03 -0700 (PDT)\r
+X-AuditID: 12074422-b7ff56d00000092f-d6-4e8251b150c5\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 1A.A1.02351.1B1528E4; Tue, 27 Sep 2011 18:44:01 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id p8RMi0dj024998; \r
+ Tue, 27 Sep 2011 18:44:00 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p8RMhwRw014030\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Tue, 27 Sep 2011 18:43:59 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)\r
+ (envelope-from <amdragon@mit.EDU>)\r
+ id 1R8gPu-0004hP-64; Tue, 27 Sep 2011 18:46:22 -0400\r
+Date: Tue, 27 Sep 2011 18:46:22 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Ali Polatel <polatel@gmail.com>, David Bremner <david@tethera.net>\r
+Subject: Re: Concerns regarding some library functions\r
+Message-ID: <20110927224622.GR17905@mit.edu>\r
+References: <871uv2unfd.fsf@gmail.com>\r
+ <87fwjhx6p5.fsf@convex-new.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87fwjhx6p5.fsf@convex-new.cs.unb.ca>\r
+User-Agent: Mutt/1.5.20 (2009-06-14)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42IRYrdT0d0Y2ORncOIUm8WN1m5Gi+s3ZzJb\r
+ 9O35xurA7LFz1l12j2erbjF7bDn0njmAOYrLJiU1J7MstUjfLoErY+G9K6wFGzgqLn/oZWlg\r
+ fMbWxcjBISFgIjFpfXUXIyeQKSZx4d56oDAXh5DAPkaJu5v3sUA4GxglLqy9yQzhnGSSuHx/\r
+ FSuEs4RRouPhA0aQfhYBVYlj7z+A2WwCGhLb9i8Hs0UE3CTu/njKDmIzC0hLfPvdzASyWljA\r
+ TOLVQjmQMK+AjsSbZX1sILaQgJ/EyTOz2CHighInZz5hgWjVkrjx7yVYK8iY5f84QExOASOJ\r
+ dU1hIBWiAioS1/a3s01gFJqFpHkWkuZZCM0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Zrq\r
+ 5WaW6KWmlG5iBIe5i9IOxp8HlQ4xCnAwKvHwCjI2+QmxJpYVV+YeYpTkYFIS5RUPAArxJeWn\r
+ VGYkFmfEF5XmpBYfYpTgYFYS4V1rBpTjTUmsrEotyodJSXOwKInzcu108BMSSE8sSc1OTS1I\r
+ LYLJynBwKEnw9oEMFSxKTU+tSMvMKUFIM3FwggznARreDFLDW1yQmFucmQ6RP8WoKCXOmwaS\r
+ EABJZJTmwfXC0tArRnGgV4R5m0CqeIApDK77FdBgJqDBXwsbQQaXJCKkpBoYuULj3l40t/h4\r
+ OL70q9k39glHJt0Ty+Of0Ou28NMhC/NLr3vD5Cd/OzHrVtfVxX7ul6V/P1756drc4LnzFfu4\r
+ d63eJnHV/mt6J+v0dnlbsY4IMWY/rafOludX5TaH762Tsjyc8UT6YVuXwlRejX0P2nYWfeG9\r
+ kFtfvOt7lUnbx9kdolVy8z2fKLEUZyQaajEXFScCAPCErBkeAwAA\r
+Cc: notmuch@notmuchmail.org\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, 27 Sep 2011 22:44:04 -0000\r
+\r
+Quoth David Bremner on Sep 27 at 1:59 pm:\r
+> On Tue, 27 Sep 2011 16:25:58 +0300, Ali Polatel <polatel@gmail.com> wrote:\r
+> \r
+> > The problem with their design is NULL return may both mean an error\r
+> > condition and "message not found". However, we already have a similar\r
+> > function which does not have such a flaw, namely notmuch_database_add_message().\r
+> \r
+> So, I take there is no way to distinguish those two outcomes? That does\r
+> sound bad. Looking at the code for notmuch-new, it looks like the return\r
+> value of notmuch_database_find_message_by_filename is used without\r
+> checking it for NULL. Austin, can you comment on that at all?\r
+\r
+I'd be happy to distinguish these outcomes. I did\r
+notmuch_database_find_message_by_filename the way I did only to be\r
+consistent with notmuch_database_find_message. Since ndfmbf isn't\r
+entrenched yet, now is a good time to change it.\r
+\r
+The call in notmuch-new should check the return, though if it can't\r
+find the message at that point, something has gone terribly wrong.\r
+Segfaulting is never the answer, though.\r