Re: [PATCH v6 00/17] Fix 'notmuch new' atomicity issues
authorAustin Clements <amdragon@MIT.EDU>
Thu, 29 Sep 2011 15:01:47 +0000 (11:01 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:30 +0000 (09:39 -0800)
11/01b3935f0b86cf80ea7864a402c5afe6ea54ef [new file with mode: 0644]

diff --git a/11/01b3935f0b86cf80ea7864a402c5afe6ea54ef b/11/01b3935f0b86cf80ea7864a402c5afe6ea54ef
new file mode 100644 (file)
index 0000000..f46d6a7
--- /dev/null
@@ -0,0 +1,121 @@
+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 3F7E6431FD0\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Sep 2011 07:59:28 -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 4nVy7Lnl+6rY for <notmuch@notmuchmail.org>;\r
+       Thu, 29 Sep 2011 07:59:27 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id D6D90431FB6\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Sep 2011 07:59:26 -0700 (PDT)\r
+X-AuditID: 1209190e-b7f4a6d0000008e5-36-4e8487ce031b\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id A2.68.02277.EC7848E4; Thu, 29 Sep 2011 10:59:26 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id p8TExPPL011990; \r
+       Thu, 29 Sep 2011 10:59:25 -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 p8TExOeN018787\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 29 Sep 2011 10:59:25 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1R9I7P-0006pj-NJ; Thu, 29 Sep 2011 11:01:47 -0400\r
+Date: Thu, 29 Sep 2011 11:01:47 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Sebastian Spaeth <Sebastian@sspaeth.de>\r
+Subject: Re: [PATCH v6 00/17] Fix 'notmuch new' atomicity issues\r
+Message-ID: <20110929150147.GC17905@mit.edu>\r
+References: <87ei34rnc5.fsf@yoom.home.cworth.org>\r
+       <1307822683-848-1-git-send-email-amdragon@mit.edu>\r
+       <87fwjgoc8f.fsf@SSpaeth.de>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87fwjgoc8f.fsf@SSpaeth.de>\r
+User-Agent: Mutt/1.5.20 (2009-06-14)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42IRYrdT1z3X3uJn8O0Zj8X1mzOZLWbNmcfo\r
+       wOTxbNUtZo/FX5ayBDBFcdmkpOZklqUW6dslcGVs3eZW0M9b8WP3B6YGxtdcXYycHBICJhLP\r
+       N05nh7DFJC7cW8/WxcjFISSwj1Fi+ZQPrBDOBkaJnQu3sYJUCQmcZJL49DgaIrGEUeLcwofM\r
+       XYwcHCwCqhJNbwxBatgENCS27V/OCGKLCGhLHG3ZAdbLLCAt8e13M1MXIzuHsICDxDc1kCiv\r
+       gI5E451eJoiJLYwSayY8ZoRICEqcnPmEBaJVS+LGv5dMIJtAxiz/xwFicgJtOvVSCKRCVEBF\r
+       4tr+drYJjEKzkDTPQtI8C6F5ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl1jvdzMEr3UlNJN\r
+       jKBw5pTk28H49aDSIUYBDkYlHt4fSc1+QqyJZcWVuYcYJTmYlER5Nze1+AnxJeWnVGYkFmfE\r
+       F5XmpBYfYpTgYFYS4Y1rA8rxpiRWVqUW5cOkpDlYlMR5V+9w8BMSSE8sSc1OTS1ILYLJynBw\r
+       KEnwvgZpFCxKTU+tSMvMKUFIM3FwggznARr+G2x4cUFibnFmOkT+FKMux9SGxycYhVjy8vNS\r
+       pcR534AUCYAUZZTmwc2BpaFXjOJAbwlDrOMBpjC4Sa+AljABLfla2AiypCQRISXVwNjzfWVg\r
+       +Wd1lQ5u9nkv1Gve8c3XZ25JK5ESL7WaeH1dpc3SBd8PuryLmOMk/Sgy+bqtZMzOxQydM0V+\r
+       FQhPcwgO+7Kdo3mCyCbzZ5LRl9fbMt8MPnzSV2T9tr0nNnMXN6tOOT/tvLH+WY3F5y1LTQou\r
+       L7c3VT+dFhsd9jbEOCKTZf2Tl27a4UosxRmJhlrMRcWJAPAh4xweAwAA\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: Thu, 29 Sep 2011 14:59:28 -0000\r
+\r
+Quoth Sebastian Spaeth on Sep 28 at  6:36 pm:\r
+> On Sat, 11 Jun 2011 16:04:26 -0400, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> > Here's the reworked patch series that uses atomic sections more\r
+> > heavily rather than changing the removal API.  This is atomic-new-v6\r
+> > on http://awakening.csail.mit.edu/git/notmuch.git .\r
+> \r
+> I just caught up implementing find_message_by_filename and\r
+> begin|end_atomic\r
+> \r
+> One oddity, since databases are opened in read-only by default, I was\r
+> surprise to see find_message_by_filename on such a database have my\r
+> python instance crash...\r
+> \r
+> > lib: Add an API to find a message by filename.\r
+> >   Culled from "lib: Add API's to find by filename and ..." in the old\r
+> >   series.  What I kept is identical.\r
+> \r
+> db.find_message_by_filename("moo")\r
+> Internal error: Failure to ensure database is writable\r
+> (lib/directory.cc:100).\r
+> \r
+> Outch?\r
+\r
+Oof.\r
+\r
+It appears that looking up a directory requires a writable database\r
+because notmuch will try to *create* a database document for the\r
+directory if one doesn't already exist.  This is clearly wrong\r
+behavior for a "find" function.\r
+\r
+The exact code path is\r
+  notmuch_database_find_message_by_filename\r
+  _notmuch_database_filename_to_direntry\r
+  _notmuch_database_find_directory_id\r
+  _notmuch_directory_create\r
+\r
+_notmuch_message_add_filename currently depends on\r
+_notmuch_database_filename_to_direntry to create the directory\r
+document if it doesn't exist.  Possibly\r
+_notmuch_database_filename_to_direntry,\r
+_notmuch_database_find_directory_id, and _notmuch_directory_create\r
+should acquire a flags argument with a "create" flag that controls\r
+this behavior.\r