12 months agotest: regression test for closing a closed database
David Bremner [Thu, 16 Jul 2020 01:59:58 +0000 (22:59 -0300)]
test: regression test for closing a closed database

This does not currently throw an error, and it should stay that way.

12 months agolib/n_d_get_version: catch exceptions and clarify the API
David Bremner [Tue, 14 Jul 2020 22:31:10 +0000 (19:31 -0300)]
lib/n_d_get_version: catch exceptions and clarify the API

notmuch_database_get_version previously returned 0 on some errors, but
did not document this. Luckily 0 is not a valid database version.

12 months agolib: move deallocation of memory from n_d_close to n_d_destroy
David Bremner [Tue, 14 Jul 2020 11:25:28 +0000 (08:25 -0300)]
lib: move deallocation of memory from n_d_close to n_d_destroy

In order to mimic the "best effort" API of Xapian to provide
information from a closed database when possible, do not
destroy the Xapian database object too early.

Because the pointer to a Xapian database is no longer nulled on close,
introduce a flag to track whether the notmuch database is open or not.

12 months agotest: add known broken test for n_d_get_version on closed db
David Bremner [Tue, 14 Jul 2020 00:30:52 +0000 (21:30 -0300)]
test: add known broken test for n_d_get_version on closed db

This should not crash, but it does currently.

12 months agotest: regression tests for n_d_status_string and n_d_get_path
David Bremner [Tue, 14 Jul 2020 00:21:03 +0000 (21:21 -0300)]
test: regression tests for n_d_status_string and n_d_get_path

These do not crash on a closed database, and we want to keep it that

Start a new file of tests as T560-lib-error was starting to get unwieldy.

12 months agolib: fix exception messages for n_m_message_*
David Bremner [Wed, 22 Jul 2020 11:19:28 +0000 (08:19 -0300)]
lib: fix exception messages for n_m_message_*

The original generic handler had an extra '%s' in the format
string. Update tests that failed to catch this because the template to
print status strings checked 'stat', which was not set.

12 months agotest: sanitize line numbers in exception reports
David Bremner [Wed, 22 Jul 2020 11:35:42 +0000 (08:35 -0300)]
test: sanitize line numbers in exception reports

Prevent test suite churn when reported line numbers change.

12 months agoemacs: notmuch-search: avoid wiping out buffer-local variables
Sean Whitton [Wed, 22 Jul 2020 15:11:32 +0000 (08:11 -0700)]
emacs: notmuch-search: avoid wiping out buffer-local variables

12 months agolib: fix return value for n_m_reindex
David Bremner [Thu, 9 Jul 2020 00:17:09 +0000 (21:17 -0300)]
lib: fix return value for n_m_reindex

Also update the documentation for the behaviour of n_m_get_thread_id
that this fix relies on.

12 months agotest: add known broken test for n_m_reindex on closed db
David Bremner [Thu, 9 Jul 2020 00:17:08 +0000 (21:17 -0300)]
test: add known broken test for n_m_reindex on closed db

This is another case where the code should not call INTERNAL_ERROR.

12 months agotest: regression for retrieving closed db from message
David Bremner [Thu, 9 Jul 2020 00:17:07 +0000 (21:17 -0300)]
test: regression for retrieving closed db from message

This is actually one of the few potentially useful things you can do
with a message belonging to a closed database, since in principle you
could re-open the database.

12 months agotest: regression test for destroying message with closed db
David Bremner [Thu, 9 Jul 2020 00:17:06 +0000 (21:17 -0300)]
test: regression test for destroying message with closed db

This should be fine because the message belongs to the
database (talloc context wise).

12 months agotest: regression tests of n_m_freeze and n_m_thaw on closed db
David Bremner [Thu, 9 Jul 2020 00:17:05 +0000 (21:17 -0300)]
test: regression tests of n_m_freeze and n_m_thaw on closed db

Neither of these accesses the database, so should be safe. Add the
tests to catch any changes in exception throwing.

12 months agolib: handle xapian exception in n_m_remove_all_tags
David Bremner [Thu, 9 Jul 2020 00:17:04 +0000 (21:17 -0300)]
lib: handle xapian exception in n_m_remove_all_tags

At least the exception we already catch should be reported properly.

12 months agotest: add broken test for n_m_remove_all_tags
David Bremner [Thu, 9 Jul 2020 00:17:03 +0000 (21:17 -0300)]
test: add broken test for n_m_remove_all_tags

The Xapian exception is actually caught here, but the NULL return is
not dealt with properly.

12 months agotest: add regression test for n_m_maildir_flags_to_tags
David Bremner [Thu, 9 Jul 2020 00:17:02 +0000 (21:17 -0300)]
test: add regression test for n_m_maildir_flags_to_tags

This function currently catches at least the obvious Xapian exceptions
and we want to keep it that way.

12 months agocli/new: replace newly deprecated n_m_has_maildir_flag
David Bremner [Mon, 13 Jul 2020 23:51:07 +0000 (20:51 -0300)]
cli/new: replace newly deprecated n_m_has_maildir_flag

Boolean return values have no out-of-band-values to signal errors. The
change here is that a (somewhat unlikely) fatal error after indexing
will now be caught.

12 months agolib: add notmuch_message_has_maildir_flag_st
David Bremner [Thu, 9 Jul 2020 00:17:01 +0000 (21:17 -0300)]
lib: add notmuch_message_has_maildir_flag_st

Initially the new function is mainly tested indirectly via the

12 months agotest: add regression test for notmuch_message_has_maildir_flag
David Bremner [Thu, 9 Jul 2020 00:17:00 +0000 (21:17 -0300)]
test: add regression test for notmuch_message_has_maildir_flag

This passes the NULL return inside _ensure_maildir_flags does not
break anything. Probably this should be handled more explicitely.

12 months agoconfigure: replace multiple redirects with redirected block
David Bremner [Wed, 15 Jul 2020 12:36:27 +0000 (09:36 -0300)]
configure: replace multiple redirects with redirected block

This belatedly implements Tomi's suggestion from

12 months agobindings/ruby: replacy use of deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:08 +0000 (15:30 -0300)]
bindings/ruby: replacy use of deprecated notmuch_message_get_flag

Depending on the flag, this actually can return an errror, so raise a
ruby exception if so.

12 months agolib/thread: replace use of deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:07 +0000 (15:30 -0300)]
lib/thread: replace use of deprecated notmuch_message_get_flag

This adds one more reason why _notmuch_thread_create might return
NULL, but those were not previously enumerated, so no promises are

12 months agolib/add-message: drop use of deprecated notmuch_message_get_flag.
David Bremner [Sat, 11 Jul 2020 18:30:06 +0000 (15:30 -0300)]
lib/add-message: drop use of deprecated notmuch_message_get_flag.

As a side effect, we revert the switch from notmuch_bool_t to bool
here. This is because those two types are not actually compatible when
passing by reference.

12 months agocli/show: replace deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:05 +0000 (15:30 -0300)]
cli/show: replace deprecated notmuch_message_get_flag

This can be seen as moving an abort out of the library, into the CLI
where we can both print to stderr and shut the process down without
ill effect.

12 months agocli/search: replace deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:04 +0000 (15:30 -0300)]
cli/search: replace deprecated notmuch_message_get_flag

Our handling of errors is all or nothing here, but it's an improvement
on the status quo, and it avoids rippling internal API changes.

12 months agolib: catch exceptions in n_m_get_flag, provide n_m_get_flag_st
David Bremner [Sat, 4 Jul 2020 15:18:05 +0000 (12:18 -0300)]
lib: catch exceptions in n_m_get_flag, provide n_m_get_flag_st

It's not very nice to return FALSE for an error, so provide
notmuch_message_get_flag_st as a migration path.

Bump LIBNOTMUCH_MINOR_VERSION because the API is extended.

12 months agoconfigure: make sure WITH_PYTHON_DOCS is initialized
David Bremner [Thu, 16 Jul 2020 18:59:45 +0000 (15:59 -0300)]
configure: make sure WITH_PYTHON_DOCS is initialized

Thanks to pazz for reporting the problem.

12 months agodoc: add new python bindings to main documentation tree.
David Bremner [Sat, 11 Jul 2020 13:20:27 +0000 (10:20 -0300)]
doc: add new python bindings to main documentation tree.

A separate and doc directory (or will be needed if someone wants
to build the bindings docs separately from notmuch.

12 months agodoc: replace use of environment variables with a generated config
David Bremner [Sat, 11 Jul 2020 13:20:26 +0000 (10:20 -0300)]
doc: replace use of environment variables with a generated config

It is getting unwieldy to pass configuration options on the
sphinx-build command line, and I anticipate further use of

As far as I could tell, execing a string is the idiomatic way to
emulate include in Python.

12 months agolib: use COERCE_STATUS in n_m_{add,remove}_tag
David Bremner [Sun, 5 Jul 2020 13:00:26 +0000 (10:00 -0300)]
lib: use COERCE_STATUS in n_m_{add,remove}_tag

Currently I don't know of a good way of testing this, but at least in
principle a Xapian exception in _notmuch_message_{add,remove}_term
would cause an abort in the library.

12 months agolib: catch Xapian exceptions in n_m_remove_tag
David Bremner [Sun, 5 Jul 2020 13:00:25 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_remove_tag

The churn here is again mainly re-indentation.

12 months agotest: add broken test for n_m_remove_tag
David Bremner [Sun, 5 Jul 2020 13:00:24 +0000 (10:00 -0300)]
test: add broken test for n_m_remove_tag

Exception will be caught in next commit.

12 months agolib: catch Xapian exceptions in n_m_add_tag
David Bremner [Sun, 5 Jul 2020 13:00:23 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_add_tag

This is mostly just (horizontal) code movement due to wrapping
everything in a try / catch.

12 months agotest: add known broken test for n_m_add_tag with closed db
David Bremner [Sun, 5 Jul 2020 13:00:22 +0000 (10:00 -0300)]
test: add known broken test for n_m_add_tag with closed db

Exception will be caught in next commit.

12 months agolib: catch Xapian exceptions in n_m_count_files
David Bremner [Sun, 5 Jul 2020 13:00:21 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_count_files

This will require some care for the caller to check the sign, and not
just add error returns into a running total.

12 months agotest: add known broken test for n_m_count_files
David Bremner [Sun, 5 Jul 2020 13:00:20 +0000 (10:00 -0300)]
test: add known broken test for n_m_count_files

This will be fixed in the next commit.

12 months agolib: catch Xapian exceptions in n_m_get_tags
David Bremner [Sun, 5 Jul 2020 13:00:19 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_get_tags

This allows the function to return an error value rather than

12 months agotest: add known broken test for n_m_get_tags
David Bremner [Sun, 5 Jul 2020 13:00:18 +0000 (10:00 -0300)]
test: add known broken test for n_m_get_tags

This will be fixed in the next commit.

12 months agolib: use LOG_XAPIAN_EXCEPTION in n_m_get_date
David Bremner [Sun, 5 Jul 2020 13:00:17 +0000 (10:00 -0300)]
lib: use LOG_XAPIAN_EXCEPTION in n_m_get_date

This should not change functionality, but does slightly reduce code
duplication. Perhaps more importantly it allows consistent changes to
all of the similar exception handling in

12 months agolib: add regression test for n_m_get_date; clarify API
David Bremner [Sun, 5 Jul 2020 13:00:16 +0000 (10:00 -0300)]
lib: add regression test for n_m_get_date; clarify API

This function catches Xapian exceptions. The test is intended to make
sure it stays that way.

12 months agotest: add known broken for n_m_get_flag on closed db
David Bremner [Sat, 4 Jul 2020 14:22:25 +0000 (11:22 -0300)]
test: add known broken for n_m_get_flag on closed db

Exception caught in next commit. Note that FLAG_GHOST is the only one
that triggers the I/O code path.

12 months agolib: catch exceptions in n_m_get_filenames
David Bremner [Sat, 4 Jul 2020 14:09:09 +0000 (11:09 -0300)]
lib: catch exceptions in n_m_get_filenames

This is essentially copied from the change to notmuch_message_get_filename

12 months agotest: add known broken test for n_m_get_filenames
David Bremner [Sat, 4 Jul 2020 14:06:37 +0000 (11:06 -0300)]
test: add known broken test for n_m_get_filenames

This will be fixed in the next commit

12 months agolib/n_m_g_filename: catch Xapian exceptions, document NULL return
David Bremner [Sat, 4 Jul 2020 12:20:31 +0000 (09:20 -0300)]
lib/n_m_g_filename: catch Xapian exceptions, document NULL return

This is the same machinery as applied for


12 months agolib: add known broken test for notmuch_message_get_filename
David Bremner [Sat, 4 Jul 2020 12:16:30 +0000 (09:16 -0300)]
lib: add known broken test for notmuch_message_get_filename

This will be fixed in the next commit

12 months agolib/n_m_get_replies: doc return, initial regression test
David Bremner [Sat, 4 Jul 2020 12:09:09 +0000 (09:09 -0300)]
lib/n_m_get_replies: doc return, initial regression test

We need to to set a query and retrieve the threads to meaningfully
test this function.

12 months agotest: add regression test for n_m_get_header
David Bremner [Sat, 4 Jul 2020 11:35:08 +0000 (08:35 -0300)]
test: add regression test for n_m_get_header

This function already catches Xapian exceptions, and we want to make
sure it stays that way.

12 months agolib/message: use LOG_XAPIAN_EXCEPTION in n_m_get_header
David Bremner [Sat, 4 Jul 2020 11:33:41 +0000 (08:33 -0300)]
lib/message: use LOG_XAPIAN_EXCEPTION in n_m_get_header

This is just for consistency, and a small reduction in the amount of

12 months agotest: drop use of assert in closed db tests
David Bremner [Sat, 4 Jul 2020 12:29:41 +0000 (09:29 -0300)]
test: drop use of assert in closed db tests

Instead of printing the same static string for each test, can replace
the assert with something simpler (or at least easier to integrate
into the test suite).

12 months agotest: remove unused backup_database calls
David Bremner [Sat, 4 Jul 2020 11:12:21 +0000 (08:12 -0300)]
test: remove unused backup_database calls

Since these backups are never restored, they should be safe to remove.

12 months agodebian: drop ValueRangeProcessor symbols
David Bremner [Sat, 11 Jul 2020 22:52:21 +0000 (19:52 -0300)]
debian: drop ValueRangeProcessor symbols

These are not used since b90d852

12 months agotest: drop upgrade from v1 tests
David Bremner [Tue, 7 Jul 2020 10:56:47 +0000 (07:56 -0300)]
test: drop upgrade from v1 tests

These are less crucial since we stopped generating new database
versions and relied primarily on features. They also rely on a
pre-generated v1 database which happens to be chert format. This
backend is not supported by Xapian 1.5.

Also drop the tool, which is currently broken, due to
changes in the testing infrastructure.

12 months agolib: migrate from Xapian ValueRangeProcessor to RangeProcessor
David Bremner [Tue, 7 Jul 2020 10:56:46 +0000 (07:56 -0300)]
lib: migrate from Xapian ValueRangeProcessor to RangeProcessor

This will be mandatory as of Xapian 1.5.  The API is also more
consistent with the FieldProcessor API, which helps code re-use a bit.

Note that this switches to using the built-in Xapian support for
prefixes on ranges (i.e. deleted code at beginning of
ParseTimeRangeProcessor::operator(), added prefix to constructor).

Another side effect of the migration is that we are generating smaller
queries, using one OP_VALUE_RANGE instead of an AND of two OP_VALUE_*

12 months agolib: migrate to post Xapian 1.3.4 compact support
David Bremner [Tue, 7 Jul 2020 10:56:45 +0000 (07:56 -0300)]
lib: migrate to post Xapian 1.3.4 compact support

The old API was deprecated in Xapian 1.3.4 and (will be) removed in 1.5.0

12 months agodoc: make gzipped man pages reproducible
Jonas Witschel [Sat, 11 Jul 2020 16:04:35 +0000 (18:04 +0200)]
doc: make gzipped man pages reproducible

gzip includes the name of the uncompressed file and its modification
timestamp into the compressed archive. The latter makes it hard to
reproduce the generated files bit for bit at a later time, so omit this
information from the archive using the "--no-name" option. This is a
reproducibility best practice, see

12 months agoMerge branch 'release'
David Bremner [Sat, 11 Jul 2020 02:24:41 +0000 (23:24 -0300)]
Merge branch 'release'

12 months agoNEWS: update date for release 0.30 archive/debian/0.30-1 debian/0.30-1
David Bremner [Sat, 11 Jul 2020 01:25:04 +0000 (22:25 -0300)]
NEWS: update date for release

12 months agodebian: changelog for 0.30
David Bremner [Sat, 11 Jul 2020 01:24:41 +0000 (22:24 -0300)]
debian: changelog for 0.30

12 months agoversion: set to 0.30
David Bremner [Sat, 11 Jul 2020 01:21:19 +0000 (22:21 -0300)]
version: set to 0.30

12 months agolib/message: catch exception in n_m_get_thread_id
David Bremner [Tue, 30 Jun 2020 01:14:11 +0000 (22:14 -0300)]
lib/message: catch exception in n_m_get_thread_id

This allows us to return an error value from the library.

12 months agotest: add known broken test for n_m_get_thread_id on closed db
David Bremner [Tue, 30 Jun 2020 01:14:10 +0000 (22:14 -0300)]
test: add known broken test for n_m_get_thread_id on closed db

This will be fixed in the next commit.

12 months agolib: catch error from closed db in n_m_get_message_id
David Bremner [Tue, 30 Jun 2020 01:14:09 +0000 (22:14 -0300)]
lib: catch error from closed db in n_m_get_message_id

By catching it at the library top level, we can return an error value.

12 months agotest: add known broken test for error handling on closed database
David Bremner [Tue, 30 Jun 2020 01:14:08 +0000 (22:14 -0300)]
test: add known broken test for error handling on closed database

Based on

13 months agobuild: produce signatures for release candidate tarballs. 0.30_rc3 debian/0.30_rc3-1
David Bremner [Tue, 16 Jun 2020 14:17:55 +0000 (11:17 -0300)]
build: produce signatures for release candidate tarballs.

Today Defalos on #notmuch asked for a signed tarball for
0.30~rc2. This is a minimal change to support this in the future.  The
question of automagically uploading will need more thought; currently
I like the fact that tags from pre-releases are only pushed manually.

13 months agotest: fix python 3.8.4 related regression in T210-raw
David Bremner [Fri, 3 Jul 2020 10:23:32 +0000 (07:23 -0300)]
test: fix python 3.8.4 related regression in T210-raw

It seems (at least in 3.8.4~rc1-1 on Debian) that set_content requires
at least one line.

13 months agodebian: changelog fo 0.30~rc3-1
David Bremner [Fri, 3 Jul 2020 09:50:16 +0000 (06:50 -0300)]
debian: changelog fo 0.30~rc3-1

13 months agoversion: bump to 0.30~rc3
David Bremner [Fri, 3 Jul 2020 09:45:17 +0000 (06:45 -0300)]
version: bump to 0.30~rc3

13 months agobindings/python-cffi: copy version file into bindings dir
David Bremner [Tue, 30 Jun 2020 00:22:47 +0000 (21:22 -0300)]
bindings/python-cffi: copy version file into bindings dir

Attempt to avoid breaking "pip install ."

As far as I can tell, we need to have a copy (not just a relative
symlink) of the version file.

13 months agodoc: update install suggestions for fedora derivatives
David Bremner [Fri, 26 Jun 2020 11:11:00 +0000 (08:11 -0300)]
doc: update install suggestions for fedora derivatives

Fedora still has an old gmime-devel which is 2.6.x. This is no longer
supported by notmuch. Also apparently dnf is a better choice than yum.

13 months agotests: mark sig verification known-broken with session keys on buggy gpgme
Daniel Kahn Gillmor [Thu, 2 Jul 2020 18:00:49 +0000 (14:00 -0400)]
tests: mark sig verification known-broken with session keys on buggy gpgme

We make use of the just-introduced configure test.

Signed-off-by: Daniel Kahn Gillmor <>
13 months agoconfigure: can gpgme can verify signatures when decrypting with a session key?
Daniel Kahn Gillmor [Thu, 2 Jul 2020 18:00:48 +0000 (14:00 -0400)]
configure: can gpgme can verify signatures when decrypting with a session key?

If is unresolved in the version of gpgme
we are testing against, then we should know about it, because it
affects the behavior of notmuch.

Signed-off-by: Daniel Kahn Gillmor <>
13 months agotest: mark two tests broken on machines with 32 bit time_t
David Bremner [Wed, 24 Jun 2020 14:32:34 +0000 (11:32 -0300)]
test: mark two tests broken on machines with 32 bit time_t

I haven't traced the code path as exhaustively for the SMIME test, but
the expiry date in question is larger then representable in a signed
32 bit integer.

13 months agoconfigure: detect 64 bit time_t
David Bremner [Wed, 24 Jun 2020 14:32:33 +0000 (11:32 -0300)]
configure: detect 64 bit time_t

Certain tests involving timestamps > 32 bits cannot pass with the
current libnotmuch API. We will avoid this issue for now by disabling
those tests on "old" architectures with 32 bit time_t.

13 months drop -std=gnu99. C11 (or later) compiler required
Tomi Ollila [Wed, 24 Jun 2020 20:11:20 +0000 (23:11 +0300)] drop -std=gnu99. C11 (or later) compiler required

Since October 2018 building notmuch has actually required compiler
that knows C11.

Also this -std=gnu99 was not used in code compiled by configure,
so in theory this could have caused problems...

...but no related reports have been sent, perhaps ever.

Both gcc and clang has been shipping compilers supporting C11
(or later) by default for more than four years now.

Therefore, just dropping -std=gnu99 (and not checking C11
compatibility for now, for simplicity) is easiest to do,
and removes inconsistency between configure and build time

13 months agopython-cffi: read version from notmuch version file
Floris Bruynooghe [Fri, 19 Jun 2020 09:46:28 +0000 (11:46 +0200)]
python-cffi: read version from notmuch version file

This keeps it in sync with the main notmuch version which is less
confusing to users.

13 months agodebian: changelog stanza for 0.30~rc2-1 archive/debian/0.30_rc2-1 debian/0.30_rc2-1
David Bremner [Tue, 16 Jun 2020 11:32:51 +0000 (08:32 -0300)]
debian: changelog stanza for 0.30~rc2-1

13 months agoversion: update to 0.30~rc2
David Bremner [Tue, 16 Jun 2020 11:29:39 +0000 (08:29 -0300)]
version: update to 0.30~rc2

13 months agodebian/copyright: update to match AUTHORS
David Bremner [Tue, 16 Jun 2020 11:28:08 +0000 (08:28 -0300)]
debian/copyright: update to match AUTHORS

13 months agoupdate AUTHORS
David Bremner [Tue, 16 Jun 2020 11:26:55 +0000 (08:26 -0300)]
update AUTHORS

Yay, we gained a new author, thanks Anton.

13 months agoSupport aborting the atomic context
Floris Bruynooghe [Sun, 14 Jun 2020 15:23:19 +0000 (17:23 +0200)]
Support aborting the atomic context

Since it is possible to use an atomic context to abort a number of
changes support this usage.  Because the only way to actually abort
the transaction is to close the database this must also do so.

Amended by db: Note the limitation requiring close is a limitation of
the underlying notmuch API, which should be fixed in a future notmuch

13 months agoMake messages returned by Thread objects owned
Floris Bruynooghe [Mon, 15 Jun 2020 20:58:50 +0000 (22:58 +0200)]
Make messages returned by Thread objects owned

This reverses the logic of StandaloneMessage to instead create a
OwnedMessage.  Only the Thread class allows retrieving messages more
then once so it can explicitly create such messages.

The added test fails with SIGABRT without the fix for the message
re-use in threads being present.

13 months agopython/notmuch2: do not destroy messages owned by a query
Anton Khirnov [Mon, 15 Jun 2020 20:58:49 +0000 (22:58 +0200)]
python/notmuch2: do not destroy messages owned by a query

Any messages retrieved from a query - either directly via
search_messages() or indirectly via thread objects - are owned by that
query. Retrieving the same message (i.e. corresponding to the same
message ID / database object) several times will always yield the same
C object.

The caller is allowed to destroy message objects owned by a query before
the query itself - which can save memory for long-lived queries.
However, that message must then never be retrieved again from that

The python-notmuch2 bindings will currently destroy every message object
in Message._destroy(), which will lead to an invalid free if the same
message is then retrieved again. E.g. the following python program leads
to libtalloc abort()ing:

import notmuch2
db   = notmuch2.Database(mode = notmuch2.Database.MODE.READ_ONLY)
t    = next(db.threads('*'))
msgs = list(zip(t.toplevel(), t.toplevel()))
msgs = list(zip(t.toplevel(), t.toplevel()))

Fix this issue by creating a subclass of Message, which is used for
"standalone" message which have to be freed by the caller. Message class
is then used only for messages descended from a query, which do not need
to be freed by the caller.

13 months agopython config access: fix style and KeyError bug
Floris Bruynooghe [Mon, 15 Jun 2020 21:55:53 +0000 (23:55 +0200)]
python config access: fix style and KeyError bug

This fixes some minor style/pep8 things and adds tests for the new
config support.  Also fixes a bug where KeyError was never raised
on a missing key.

13 months agopython/notmuch2: add bindings for the database config strings
Anton Khirnov [Mon, 15 Jun 2020 21:55:52 +0000 (23:55 +0200)]
python/notmuch2: add bindings for the database config strings

13 months agoUpdate tox.ini for python3.8 and fix pypy3.6
Floris Bruynooghe [Sun, 14 Jun 2020 19:25:46 +0000 (21:25 +0200)]
Update tox.ini for python3.8 and fix pypy3.6

Python 3.8 has been released for a while now, make sure we keep
supporting it correctly.

PyPy 3.6 wasn not configured correctly.

13 months agoAdd missing set methods to tagsets
Floris Bruynooghe [Sun, 14 Jun 2020 18:33:55 +0000 (20:33 +0200)]
Add missing set methods to tagsets

Even though we use which implements all these
methods under their operator names, the actual named variations of
these methods are shockingly missing.  So let's add them manually.

13 months agoconfigure: use cffi.FFI().verify() to test buildability of CFFI bindings
Tomi Ollila [Tue, 9 Jun 2020 12:32:27 +0000 (15:32 +0300)]
configure: use cffi.FFI().verify() to test buildability of CFFI bindings

Checking existence of pyconfig.h to determine whether CFFI-based
notmuch bindings are buildable is not enough; for example Fedora 32
ships pyconfig.h in python3-libs package, but python3-devel is required
to be installed for the bindings to build.

Executing cffi.FFI().verify() is pretty close to what is done in
bindings/python-cffi/notmuch2/ to get the c code part of the
bindings built.

13 months agodebian: changelog stanza for 0.30~rc1-1 0.30_rc1 archive/debian/0.30_rc1-1 debian/0.30_rc1-1
David Bremner [Sat, 6 Jun 2020 11:03:25 +0000 (08:03 -0300)]
debian: changelog stanza for 0.30~rc1-1

13 months agoversion: bump to 0.30~rc1
David Bremner [Sat, 6 Jun 2020 11:02:16 +0000 (08:02 -0300)]
version: bump to 0.30~rc1

13 months agoemacs docstrings: consistent indentation, newlines, periods
Tomi Ollila [Sun, 24 May 2020 19:17:56 +0000 (22:17 +0300)]
emacs docstrings: consistent indentation, newlines, periods

Fixed emacs docstrings to be consistent. No functional change.

- removed some (accidental) indentation
- removed some trailing newlines
- added trailing periods where missing (some exclusions)

13 months agodoc: field processor support now always included, adjust manual pages
Tomi Ollila [Tue, 2 Jun 2020 20:21:59 +0000 (23:21 +0300)]
doc: field processor support now always included, adjust manual pages

The features that require field processor support, are now just
documented w/o mentioning **Xapian Field Processors**' is needed
for those.

Replaced "compact" and "field_processor" with "retry_lock" in
build_with config option, as it is currently the only one that
is optionally excluded. The former 2 are now documented as
features always included.

Dropped one 'we' "passive" in notmuch-search-terms.rst. It was the
only one, and inconsistent with rest of the documentation in that

Dropped message about conditional open-ended ranges support, as
those are now always supported.

13 months agoconfigure: require python 3.5 for CFFI-based notmuch bindings
Tomi Ollila [Fri, 5 Jun 2020 21:57:55 +0000 (00:57 +0300)]
configure: require python 3.5 for CFFI-based notmuch bindings

Also tell users what the consequences of a "No" answer is when
python version is less than 3.5, cffi or setuptools is missing,
or no pytest >= 3.0 is available.

13 months agodebian: update debian/copyright
David Bremner [Thu, 4 Jun 2020 11:53:27 +0000 (08:53 -0300)]
debian: update debian/copyright

This is based on the updated AUTHORS file.

13 months agodoc: update AUTHORS file
David Bremner [Thu, 4 Jun 2020 11:36:39 +0000 (08:36 -0300)]
doc: update AUTHORS file

I tried to be inclusive, and did not delete anyone from Carl's
original file. I also reworded the acknowledgement of Google LLC.

13 months agodevel: script to calculate a list of authors.
David Bremner [Wed, 3 Jun 2020 16:05:12 +0000 (13:05 -0300)]
devel: script to calculate a list of authors.

As an initial heuristic, report anyone with at least 15 lines of code
in the current source tree. Test corpora are excluded, although
probabably this doesn't change much about the list of authors

13 months agotweaks to NEWS suggest by Tomi
David Bremner [Fri, 5 Jun 2020 09:58:31 +0000 (06:58 -0300)]
tweaks to NEWS suggest by Tomi


13 months agoNEWS: The minimum supported version of Xapian is now 1.4.0
Tomi Ollila [Thu, 4 Jun 2020 19:38:35 +0000 (22:38 +0300)]
NEWS: The minimum supported version of Xapian is now 1.4.0

14 months agoadd NEWS for 0.30
Daniel Kahn Gillmor [Tue, 2 Jun 2020 01:54:56 +0000 (21:54 -0400)]
add NEWS for 0.30

Signed-off-by: Daniel Kahn Gillmor <>
14 months agodebian: bump debian revision archive/debian/0.30_rc0-2 debian/0.30_rc0-2
David Bremner [Tue, 2 Jun 2020 02:16:09 +0000 (23:16 -0300)]
debian: bump debian revision

second, with binaries upload

14 months agodebian: Add build dependency on doxygen 0.30_rc0 archive/debian/0.30_rc0-1 debian/0.30_rc0-1
David Bremner [Tue, 2 Jun 2020 00:38:02 +0000 (21:38 -0300)]
debian: Add build dependency on doxygen