[Lars Luthman] Bug#826881: Calls to notmuch_directory_get_mtime() don't return the recently set mtime

Subject: [Lars Luthman] Bug#826881: Calls to notmuch_directory_get_mtime() don't return the recently set mtime

Date: Thu, 09 Jun 2016 17:26:19 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


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

Thread: