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