v2 format_raw fix

2019-04-28 Thread David Bremner
This series just adds tests for Rob's fix. I'm resending Rob's patch as well because I added a single deletion (of the known_broken test). ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch

[PATCH 2/2] cli/show: avoid empty write to stdout in format_part_raw

2019-04-28 Thread David Bremner
From: Rob Browning Previously (at least) if the input was exactly 4096 bytes long, notmuch would attempt to fwrite nothing to stdout, but still expected fwrite to return 1, causing a failure that looked like this: $ notmuch show --format=raw id:87o96f1cya@codeaurora.org ...entire

[PATCH 1/2] test: notmuch show --format=raw for 4096 byte messages.

2019-04-28 Thread David Bremner
Rob Browning isolated a bug where files of exactly 4096 bytes generate errors because of a zero byte read. --- test/T210-raw.sh | 29 + 1 file changed, 29 insertions(+) diff --git a/test/T210-raw.sh b/test/T210-raw.sh index 99fdef72..e1dd6064 100755 ---

[PATCH 2/9] cli/config: refactor _stored_in_db

2019-04-28 Thread David Bremner
This will make it easier to add other prefixes that are stored in the database, compared to special casing each one as "query." was. --- notmuch-config.c | 47 +-- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/notmuch-config.c

[PATCH 6/9] lib: cache user prefixes in database object

2019-04-28 Thread David Bremner
This will be used to avoid needing a database access to resolve a db prefix from the corresponding UI prefix (e.g. when indexing). Arguably the setup of the seperate header map does not belong here, since it is about indexing rather than querying, but we currently don't have any other indexing

[PATCH 5/9] lib: setup user headers in query parser

2019-04-28 Thread David Bremner
These tests will need to be updated if the Xapian query print/debug format changes. --- lib/database.cc | 37 + lib/notmuch-private.h| 2 ++ test/T750-user-header.sh | 21 + 3 files changed, 60 insertions(+) diff --git

[PATCH 8/9] lib/database: index user headers.

2019-04-28 Thread David Bremner
There is a O(log(#user headers)) penalty for the second lookup of the prefix name. --- lib/database.cc | 6 ++ lib/index.cc | 27 +++ lib/notmuch-private.h| 5 + test/T750-user-header.sh | 17 + 4 files changed, 55

[PATCH 7/9] lib: support user prefix names in term generation

2019-04-28 Thread David Bremner
This should not change the indexing process yet as nothing calls _notmuch_message_gen_terms with a user prefix name. On the other hand, it should not break anything either. --- lib/database.cc | 20 lib/message.cc| 6 +- lib/notmuch-private.h | 1 + 3

[PATCH 9/9] doc: document user header indexing.

2019-04-28 Thread David Bremner
It's a bit odd that the primary documentation is in notmuch-config, but it is consistent with the "query:" prefix. --- doc/man1/notmuch-config.rst | 9 + doc/man7/notmuch-search-terms.rst | 3 +++ 2 files changed, 12 insertions(+) diff --git a/doc/man1/notmuch-config.rst

[PATCH 4/9] cli/config: check syntax of user configured field names

2019-04-28 Thread David Bremner
These restrictions are meant to prevent incompatibilities with the Xapian query parser (which will split at non-word characters) and clashes with future notmuch builtin fields. --- notmuch-config.c | 41 +++- test/T750-user-header.sh | 30

Index user defined headers v2

2019-04-28 Thread David Bremner
It turned out to be not-completely-trivial to rebase onto master, so I decided to post the rebased patches for potential review. I also did a bunch of cosmetic changes, but other than not breaking body: searching, there are no functionality changes since [1] [1]

[PATCH 1/9] util: add unicode_word_utf8

2019-04-28 Thread David Bremner
This originally use Xapian::Unicode::is_wordchar, but that forces clients to link directly to libxapian, which seems like it might be busywork if nothing else. --- util/Makefile.local | 3 ++- util/unicode-util.c | 43 +++ util/unicode-util.h | 12

[PATCH 3/9] cli/config: support user header index config

2019-04-28 Thread David Bremner
We don't do anything with this configuration information information yet, but nonetheless add a couple of regression tests to make sure we don't break standard functionality when we do use the configuration information. --- notmuch-config.c | 1 + test/T750-user-header.sh | 43