--- /dev/null
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id C65746DE01BE\r
+ for <notmuch@notmuchmail.org>; Thu, 9 Jun 2016 13:26:32 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.011\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.011 tagged_above=-999 required=5\r
+ tests=[AWL=-0.000, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id vjhxMg6j79vw for <notmuch@notmuchmail.org>;\r
+ Thu, 9 Jun 2016 13:26:25 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id C31476DE0130\r
+ for <notmuch@notmuchmail.org>; Thu, 9 Jun 2016 13:26:24 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1bB6Wo-0007E3-30; Thu, 09 Jun 2016 16:26:10 -0400\r
+Received: (nullmailer pid 14395 invoked by uid 1000);\r
+ Thu, 09 Jun 2016 20:26:19 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Lars Luthman] Bug#826881: Calls to notmuch_directory_get_mtime()\r
+ don't return the recently set mtime\r
+User-Agent: Notmuch/0.22+28~gb9bf3f4 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Thu, 09 Jun 2016 17:26:19 -0300\r
+Message-ID: <87k2hyxg5w.fsf@tesseract.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: message/rfc822\r
+Content-Disposition: inline\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 09 Jun 2016 20:26:32 -0000\r
+\r
+Return-path: <bounces+20160609-bremner=debian.org@tracker.debian.org>\r
+Envelope-to: david@tethera.net\r
+Delivery-date: Thu, 09 Jun 2016 14:09:01 -0400\r
+Received: from mailly.debian.org ([2001:41b8:202:deb:6564:a62:52c3:4b72])\r
+ by fethera.tethera.net with esmtp (Exim 4.84)\r
+ (envelope-from <bounces+20160609-bremner=debian.org@tracker.debian.org>)\r
+ id 1bB4O5-0005dC-54\r
+ for david@tethera.net; Thu, 09 Jun 2016 14:09:01 -0400\r
+Received: from ticharich.debian.org ([2001:41c8:1000:21::21:23]) from\r
+ C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP\r
+ CA,CN=ticharich.debian.org,EMAIL=hostmaster@ticharich.debian.org (verified)\r
+ by mailly.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\r
+ (Exim 4.84_2) (envelope-from\r
+ <bounces+20160609-bremner=debian.org@tracker.debian.org>) id 1bB4OG-000552-BP\r
+ for david@tethera.net; Thu, 09 Jun 2016 18:09:12 +0000\r
+Received: from localhost ([::1] helo=ticharich.debian.org)\r
+ by ticharich.debian.org with esmtp (Exim 4.84_2)\r
+ (envelope-from <bounces+20160609-bremner=debian.org@tracker.debian.org>)\r
+ id 1bB4OF-0005bV-WA\r
+ for david@tethera.net; Thu, 09 Jun 2016 18:09:11 +0000\r
+Received: from muffat.debian.org ([2607:f8f0:610:4000:6564:a62:ce0c:1392])\r
+ from C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP\r
+ CA,CN=muffat.debian.org,EMAIL=hostmaster@muffat.debian.org (verified) by\r
+ ticharich.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\r
+ (Exim 4.84_2) (envelope-from <debbugs@buxtehude.debian.org>) id\r
+ 1bB4OF-0005ab-Kx for dispatch+notmuch@tracker.debian.org; Thu, 09 Jun 2016\r
+ 18:09:11 +0000\r
+Received: from quantz.debian.org ([2001:41c8:1000:21::21:28]) from\r
+ C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP\r
+ CA,CN=quantz.debian.org,EMAIL=hostmaster@quantz.debian.org (verified) by\r
+ muffat.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim\r
+ 4.84_2) (envelope-from <debbugs@buxtehude.debian.org>) id 1bB4OE-00048R-23\r
+ for dispatch+notmuch@tracker.debian.org; Thu, 09 Jun 2016 18:09:10 +0000\r
+Received: from qa by quantz.debian.org with local (Exim 4.84_2)\r
+ (envelope-from <debbugs@buxtehude.debian.org>)\r
+ id 1bB4OC-00087e-Im\r
+ for dispatch+notmuch@tracker.debian.org; Thu, 09 Jun 2016 18:09:08 +0000\r
+Received: from buxtehude.debian.org ([2607:f8f0:610:4000:2015:12:0:147]) from\r
+ C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP\r
+ CA,CN=buxtehude.debian.org,EMAIL=hostmaster@buxtehude.debian.org (verified)\r
+ by quantz.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\r
+ (Exim 4.84_2) (envelope-from <debbugs@buxtehude.debian.org>) id\r
+ 1bB4OC-00087X-9W for notmuch@packages.qa.debian.org; Thu, 09 Jun 2016\r
+ 18:09:08 +0000\r
+Received: from debbugs by buxtehude.debian.org with local (Exim 4.84_2)\r
+ (envelope-from <debbugs@buxtehude.debian.org>)\r
+ id 1bB4OA-0004eS-Ld; Thu, 09 Jun 2016 18:09:06 +0000\r
+X-Loop: owner@bugs.debian.org\r
+Subject: Bug#826881: Calls to notmuch_directory_get_mtime() don't return the\r
+ recently set mtime\r
+Reply-To: Lars Luthman <deb-bugs@larsluthman.net>, 826881@bugs.debian.org\r
+Resent-From: Lars Luthman <deb-bugs@larsluthman.net>\r
+Resent-To: debian-bugs-dist@lists.debian.org\r
+Resent-CC: Carl Worth <cworth@debian.org>\r
+X-Loop: owner@bugs.debian.org\r
+Resent-Date: Thu, 09 Jun 2016 18:09:02 +0000\r
+Resent-Message-ID: <handler.826881.B.146549559117416@bugs.debian.org>\r
+X-Debian-PR-Message: report 826881\r
+X-Debian-PR-Package: libnotmuch-dev\r
+X-Debian-PR-Keywords: patch\r
+X-Debian-PR-Source: notmuch\r
+Received: via spool by submit@bugs.debian.org id=B.146549559117416\r
+ (code B); Thu, 09 Jun 2016 18:09:02 +0000\r
+Received: (at submit) by bugs.debian.org; 9 Jun 2016 18:06:31 +0000\r
+X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02\r
+ (2014-02-07) on buxtehude.debian.org\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-7.2 required=4.0 tests=BAYES_00,FOURLA,HAS_PACKAGE,\r
+ MURPHY_DRUGS_REL8,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,\r
+ RCVD_IN_MSPIKE_WL,SPF_PASS,URIBL_CNKR autolearn=ham autolearn_force=no\r
+ version=3.4.0-bugs.debian.org_2005_01_02\r
+X-Spam-Bayes: score:0.0000 Tokens: new, 22; hammy, 150; neutral, 64; spammy,\r
+ 0. spammytokens: hammytokens:0.000-+--systemd, 0.000-+--H*x:3.12.9-1,\r
+ 0.000-+--H*UA:3.12.9-1, 0.000-+--en_GButf8, 0.000-+--en_gb.utf8\r
+Received: from v-smtpgw2.han.skanova.net ([81.236.60.205])\r
+ by buxtehude.debian.org with esmtp (Exim 4.84_2)\r
+ (envelope-from <deb-bugs@larsluthman.net>)\r
+ id 1bB4Le-0004WV-VR\r
+ for submit@bugs.debian.org; Thu, 09 Jun 2016 18:06:31 +0000\r
+Received: from miskatonic.local ([78.69.244.232])\r
+ by cmsmtp with SMTP\r
+ id B4LWbP4U0ctqUB4LWb67E7; Thu, 09 Jun 2016 20:06:22 +0200\r
+Message-ID: <1465495580.10511.8.camel@larsluthman.net>\r
+From: Lars Luthman <deb-bugs@larsluthman.net>\r
+To: submit <submit@bugs.debian.org>\r
+Date: Thu, 09 Jun 2016 20:06:20 +0200\r
+X-Mailer: Evolution 3.12.9-1+b1 \r
+X-CMAE-Envelope: MS4wfJIgoFnyqltd8L7/VPWXklBfV8Avcn6YiEBeVMgWKl/sx7ZZxTodvcElNPw5U47QSvDj/rHXtoZxCjfBaZMtghhxPaMqRhP3Md6vu7zCZr5p58KZgYgX\r
+ rtbPk3salVbeqN6a+oxlsRu0Epo2Q395HiHAv8lV8WdPmfAMx7yMqumzp3Oz6R9b8OLYlU7/hiaXtw==\r
+Delivered-To: submit@bugs.debian.org\r
+Delivered-To: notmuch@packages.qa.debian.org\r
+Delivered-To: dispatch+notmuch@tracker.debian.org\r
+X-Loop: dispatch@tracker.debian.org\r
+X-Distro-Tracker-Package: notmuch\r
+X-Distro-Tracker-Keyword: bts\r
+List-Id: <notmuch.tracker.debian.org>\r
+X-Debian-Package: notmuch\r
+X-Debian: tracker.debian.org\r
+X-PTS-Package: notmuch\r
+X-PTS-Keyword: bts\r
+Precedence: list\r
+List-Unsubscribe:\r
+ <mailto:control@tracker.debian.org?body=unsubscribe%20notmuch>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="==-=-="\r
+\r
+--==-=-=\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+\r
+Package: libnotmuch-dev\r
+Version: 0.18.2-1\r
+Severity: normal\r
+Tags: patch\r
+\r
+notmuch_directory_set_mtime() sets the new mtime in the database, but\r
+doesn't update the cached value in the notmuch_directory_t object, which\r
+is what notmuch_directory_get_mtime() returns. This means that this\r
+sequence of calls:\r
+\r
+ notmuch_directory_set_mtime(dir, 12345);\r
+ assert(notmuch_directory_get_mtime(dir) == 12345);\r
+\r
+will fail, which can be very confusing - I was writing unit tests for a\r
+library wrapper and it took a while to figure out what was going on.\r
+\r
+Destroying the directory object and creating a new one will cause\r
+notmuch_directory_get_mtime() to return the correct value.\r
+\r
+If this is the intended behaviour it should probably be documented. If\r
+it's not, the attached patch should fix it. \r
+\r
+-- System Information:\r
+Debian Release: 8.5\r
+ APT prefers stable-updates\r
+ APT policy: (500, 'stable-updates'), (500, 'stable')\r
+Architecture: i386 (i686)\r
+\r
+Kernel: Linux 3.16.0-4-686-pae (SMP w/2 CPU cores)\r
+Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)\r
+Shell: /bin/sh linked to /bin/dash\r
+Init: systemd (via /run/systemd/system)\r
+\r
+Versions of packages libnotmuch-dev depends on:\r
+ii libnotmuch3 0.18.2-1\r
+\r
+libnotmuch-dev recommends no packages.\r
+\r
+libnotmuch-dev suggests no packages.\r
+\r
+-- no debconf information\r
+\r
+--==-=-=\r
+Content-Type: text/x-patch; charset=utf-8; name=set_cached_mtime.diff\r
+Content-Disposition: attachment; filename=set_cached_mtime.diff\r
+\r
+diff -ru notmuch-0.18.2-old/lib/directory.cc notmuch-0.18.2/lib/directory.cc\r
+--- notmuch-0.18.2-old/lib/directory.cc 2016-06-09 19:45:49.870660808 +0200\r
++++ notmuch-0.18.2/lib/directory.cc 2016-06-09 19:46:43.670658075 +0200\r
+@@ -230,6 +230,7 @@\r
+ return NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
+ }\r
+ \r
++ directory->mtime = mtime;\r
+ return NOTMUCH_STATUS_SUCCESS;\r
+ }\r
+ \r
+Only in notmuch-0.18.2/lib: directory.cc~\r
+\r
+--==-=-=--\r