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