diff --git a/Makefile.global b/Makefile.global index 8477468d..fe79121d 100644 --- a/Makefile.global +++ b/Makefile.global @@ -36,7 +36,6 @@ endif endif UPSTREAM_TAG=$(subst ~,_,$(VERSION)) -DEB_TAG=debian/$(UPSTREAM_TAG)-1 RELEASE_HOST=notmuchmail.org RELEASE_DIR=/srv/notmuchmail.org/www/releases diff --git a/Makefile.local b/Makefile.local index fb126294..bbb8f0b6 100644 --- a/Makefile.local +++ b/Makefile.local @@ -73,12 +73,11 @@ release: verify-source-tree-and-version $(MAKE) VERSION=$(VERSION) $(SHA256_FILE) $(DETACHED_SIG_FILE) ln -sf $(TAR_FILE) $(DEB_TAR_FILE) pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG) - git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG) mkdir -p releases mv $(TAR_FILE) $(SHA256_FILE) $(DETACHED_SIG_FILE) releases $(MAKE) VERSION=$(VERSION) release-message > $(PACKAGE)-$(VERSION).announce ifeq ($(REALLY_UPLOAD),yes) - git push origin $(VERSION) $(DEB_TAG) release pristine-tar + git push origin $(VERSION) release pristine-tar cd releases && scp $(TAR_FILE) $(SHA256_FILE) $(DETACHED_SIG_FILE) $(RELEASE_HOST):$(RELEASE_DIR) ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-* ; ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(TAR_FILE)" rsync --verbose --delete --recursive doc/_build/html/ $(RELEASE_HOST):$(DOC_DIR) @@ -90,7 +89,6 @@ pre-release: $(MAKE) VERSION=$(VERSION) clean $(MAKE) VERSION=$(VERSION) test git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG) - git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG) $(MAKE) VERSION=$(VERSION) $(SHA256_FILE) $(DETACHED_SIG_FILE) ln -sf $(TAR_FILE) $(DEB_TAR_FILE) pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG) diff --git a/NEWS b/NEWS index 677c507d..6e88ebd9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,34 @@ +Notmuch 0.31.4 (2021-02-18) +=========================== + +Library +------- + +Fix include bug triggered by glib 2.67. + +Test +---- + +Fix race condition in T568-lib-thread. + +Notmuch 0.31.3 (2020-12-25) +=========================== + +Bindings +-------- + +Fix for exclude tags in notmuch2 bindings. + +Build +----- + +Portability update for T360-symbol-hiding + +Library +------- + +Fix for memory error in notmuch_database_get_config_list + Notmuch 0.31.2 (2020-11-08) =========================== diff --git a/bindings/python-cffi/notmuch2/_database.py b/bindings/python-cffi/notmuch2/_database.py index 5ab0f20a..868f4408 100644 --- a/bindings/python-cffi/notmuch2/_database.py +++ b/bindings/python-cffi/notmuch2/_database.py @@ -578,7 +578,7 @@ class Database(base.NotmuchObject): if exclude_tags is not None: for tag in exclude_tags: if isinstance(tag, str): - tag = str.encode('utf-8') + tag = tag.encode('utf-8') capi.lib.notmuch_query_add_tag_exclude(query_p, tag) return querymod.Query(self, query_p) diff --git a/bindings/python-cffi/version.txt b/bindings/python-cffi/version.txt index c415e1c6..a8a02172 100644 --- a/bindings/python-cffi/version.txt +++ b/bindings/python-cffi/version.txt @@ -1 +1 @@ -0.31.2 +0.31.4 diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py index 0d8fdd04..6f6372ab 100644 --- a/bindings/python/notmuch/version.py +++ b/bindings/python/notmuch/version.py @@ -1,3 +1,3 @@ # this file should be kept in sync with ../../../version -__VERSION__ = '0.31.2' +__VERSION__ = '0.31.4' SOVERSION = '5' diff --git a/debian/changelog b/debian/changelog index b5ef8645..85263214 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,48 @@ +notmuch (0.31.4-2) unstable; urgency=medium + + * Cherry pick upstream commit 3f4de98e7c8, which fixes a bug where + duplicate message-ids can cause multiple thread-ids for some message + documents. + * Add build-dependency on xapian-tools, for new test + + -- David Bremner Mon, 28 Jun 2021 22:48:02 -0300 + +notmuch (0.31.4-1) unstable; urgency=medium + + * New upstream bugfix release + - Fix include bug triggered by glib 2.67 + - Fix race condition in T568-lib-thread + + -- David Bremner Thu, 18 Feb 2021 07:23:00 -0400 + +notmuch (0.31.3-2) unstable; urgency=medium + + * Don't install gdb on hppa (skip gdb based tests) + + -- David Bremner Sat, 26 Dec 2020 15:14:07 -0400 + +notmuch (0.31.3-1) unstable; urgency=medium + + * New upstream bugfix release + * Second fix for T360, fix regression on ppc64el + * Fix for exclude tags in notmuch2 python bindings + * Fix for memory error in notmuch_database_get_config_list + + -- David Bremner Fri, 25 Dec 2020 11:48:37 -0400 + +notmuch (0.31.2-5) unstable; urgency=medium + + * Use readelf instead of nm in T360, hopefully build in ppc64 + + -- David Bremner Sun, 13 Dec 2020 08:24:23 -0400 + +notmuch (0.31.2-4) unstable; urgency=medium + + * Move prerequisite to file targets from phony ones. Thanks to + Lucas Nussbaum for the report. (Closes: #976934). + + -- David Bremner Thu, 10 Dec 2020 21:02:20 -0400 + notmuch (0.31.2-3~bpo10+2) buster-backports; urgency=medium * Re-upload with binaries for NEW package. diff --git a/debian/control b/debian/control index 9b8674df..19e669b0 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Uploaders: Jameson Graef Rollins , David Bremner , Build-Conflicts: - gdb [ia64 mips mips64el], + gdb [ia64 mips mips64el hppa], gdb-minimal, ruby1.8, Build-Depends: @@ -19,7 +19,7 @@ Build-Depends: dpkg-dev (>= 1.17.14), dtach (>= 0.8) , emacs-nox | emacs-gtk | emacs-lucid | emacs25-nox | emacs25 (>=25~) | emacs25-lucid (>=25~) | emacs24-nox | emacs24 (>=24~) | emacs24-lucid (>=24~), - gdb [!ia64 !mips !mips64el !kfreebsd-any !alpha] , + gdb [!ia64 !mips !mips64el !kfreebsd-any !alpha !hppa] , gnupg , gpgsm , libgmime-3.0-dev (>= 3.0.3~), @@ -37,6 +37,7 @@ Build-Depends: ruby, ruby-dev (>>1:1.9.3~), texinfo, + xapian-tools , Standards-Version: 4.4.1 Homepage: https://notmuchmail.org/ Vcs-Git: https://git.notmuchmail.org/git/notmuch -b release diff --git a/debian/patches/debian-changes b/debian/patches/debian-changes new file mode 100644 index 00000000..d6927fd0 --- /dev/null +++ b/debian/patches/debian-changes @@ -0,0 +1,136 @@ +This is an autogenerated patch header for a single-debian-patch file. The +delta against upstream is either kept as a single patch, or maintained +in some VCS, and exported as a single patch instead of more manageable +atomic patches. + +--- notmuch-0.31.4.orig/lib/add-message.cc ++++ notmuch-0.31.4/lib/add-message.cc +@@ -407,14 +407,17 @@ static notmuch_status_t + _notmuch_database_link_message (notmuch_database_t *notmuch, + notmuch_message_t *message, + notmuch_message_file_t *message_file, +- bool is_ghost) ++ bool is_ghost, ++ bool is_new) + { + void *local = talloc_new (NULL); + notmuch_status_t status; + const char *thread_id = NULL; + + /* Check if the message already had a thread ID */ +- if (notmuch->features & NOTMUCH_FEATURE_GHOSTS) { ++ if (! is_new) { ++ thread_id = notmuch_message_get_thread_id (message); ++ } else if (notmuch->features & NOTMUCH_FEATURE_GHOSTS) { + if (is_ghost) + thread_id = notmuch_message_get_thread_id (message); + } else { +@@ -539,7 +542,7 @@ notmuch_database_index_file (notmuch_dat + } + + ret = _notmuch_database_link_message (notmuch, message, +- message_file, is_ghost); ++ message_file, is_ghost, is_new); + if (ret) + goto DONE; + +--- notmuch-0.31.4.orig/test/T357-index-decryption.sh ++++ notmuch-0.31.4/test/T357-index-decryption.sh +@@ -112,12 +112,10 @@ test_expect_equal \ + "$expected" + + # try inserting it with decryption, should appear as a single copy +-# (note: i think thread id skips 4 because of duplicate message-id +-# insertion, above) + test_begin_subtest "message cleartext is present with insert --decrypt=true" + notmuch insert --folder=sent --decrypt=true <<<"$contents" +-output=$(notmuch search wumpus) +-expected='thread:0000000000000005 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox unread)' ++output=$(notmuch search wumpus | notmuch_search_sanitize) ++expected='thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox unread)' + test_expect_equal \ + "$output" \ + "$expected" +@@ -127,9 +125,9 @@ test_expect_equal \ + test_begin_subtest 'tagging all messages' + test_expect_success 'notmuch tag +blarney "encrypted message"' + test_begin_subtest "verify that tags have not changed" +-output=$(notmuch search tag:blarney) +-expected='thread:0000000000000001 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) +-thread:0000000000000005 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' ++output=$(notmuch search tag:blarney | notmuch_search_sanitize) ++expected='thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) ++thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' + test_expect_equal \ + "$output" \ + "$expected" +@@ -138,14 +136,14 @@ test_expect_equal \ + test_begin_subtest 'reindex old messages' + test_expect_success 'notmuch reindex --decrypt=true tag:encrypted and not property:index.decryption=success' + test_begin_subtest "reindexed encrypted message, including cleartext" +-output=$(notmuch search wumpus) ++output=$(notmuch search wumpus | notmuch_search_sanitize) + test_expect_equal \ + "$output" \ + "$expected" + + # and the same search, but by property ($expected is untouched): + test_begin_subtest "emacs search by property for both messages" +-output=$(notmuch search property:index.decryption=success) ++output=$(notmuch search property:index.decryption=success | notmuch_search_sanitize) + test_expect_equal \ + "$output" \ + "$expected" +@@ -154,7 +152,7 @@ test_expect_equal \ + test_begin_subtest 'reindex in auto mode' + test_expect_success 'notmuch reindex tag:encrypted and property:index.decryption=success' + test_begin_subtest "reindexed encrypted messages, should not have changed" +-output=$(notmuch search wumpus) ++output=$(notmuch search wumpus | notmuch_search_sanitize) + test_expect_equal \ + "$output" \ + "$expected" +@@ -188,9 +186,9 @@ test_expect_equal \ + + # ensure that the tags remain even when we are dropping the cleartext. + test_begin_subtest "verify that tags remain without cleartext" +-output=$(notmuch search tag:blarney) +-expected='thread:0000000000000001 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) +-thread:0000000000000005 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' ++output=$(notmuch search tag:blarney | notmuch_search_sanitize) ++expected='thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) ++thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' + test_expect_equal \ + "$output" \ + "$expected" +@@ -199,7 +197,7 @@ test_begin_subtest "index cleartext with + test_expect_success "notmuch reindex --decrypt=nostash tag:blarney" + + test_begin_subtest "Ensure that the indexed terms are present" +-output=$(notmuch search wumpus) ++output=$(notmuch search wumpus | notmuch_search_sanitize) + test_expect_equal \ + "$output" \ + "$expected" +--- notmuch-0.31.4.orig/test/T670-duplicate-mid.sh ++++ notmuch-0.31.4/test/T670-duplicate-mid.sh +@@ -6,6 +6,19 @@ add_message '[id]="duplicate"' '[subject + add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2' + + add_message '[id]="duplicate"' '[subject]="message 0" [filename]=copy0' ++ ++test_begin_subtest 'at most 1 thread-id per xapian document' ++db=${MAIL_DIR}/.notmuch/xapian ++for doc in $(xapian-delve -1 -t '' "$db" | grep '^[1-9]'); do ++ xapian-delve -1 -r "$doc" "$db" | grep -c '^G' ++done > OUTPUT.raw ++sort -u < OUTPUT.raw > OUTPUT ++cat < EXPECTED ++0 ++1 ++EOF ++test_expect_equal_file EXPECTED OUTPUT ++ + test_begin_subtest 'search: first indexed subject preserved' + cat < EXPECTED + thread:XXX 2001-01-05 [1/1(3)] Notmuch Test Suite; message 1 (inbox unread) diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..7bb82529 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +debian-changes diff --git a/doc/Makefile.local b/doc/Makefile.local index 60bd7184..f476d1da 100644 --- a/doc/Makefile.local +++ b/doc/Makefile.local @@ -43,7 +43,7 @@ INFO_INFO_FILES := $(INFO_TEXI_FILES:.texi=.info) rm -f $@ && gzip --no-name --stdout $^ > $@ ifeq ($(WITH_EMACS),1) -$(DOCBUILDDIR)/.roff.stamp sphinx-html sphinx-texinfo: docstring.stamp +$(DOCBUILDDIR)/.roff.stamp $(DOCBUILDDIR)/.html.stamp $(DOCBUILDDIR)/.texi.stamp : docstring.stamp endif sphinx-html: $(DOCBUILDDIR)/.html.stamp diff --git a/doc/conf.py b/doc/conf.py index 11bed51d..1a5c217b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -14,7 +14,7 @@ master_doc = 'index' # General information about the project. project = u'notmuch' -copyright = u'2009-2020, Carl Worth and many others' +copyright = u'2009-2021, Carl Worth and many others' location = os.path.dirname(__file__) diff --git a/lib/add-message.cc b/lib/add-message.cc index 485debad..b47aa501 100644 --- a/lib/add-message.cc +++ b/lib/add-message.cc @@ -407,14 +407,17 @@ static notmuch_status_t _notmuch_database_link_message (notmuch_database_t *notmuch, notmuch_message_t *message, notmuch_message_file_t *message_file, - bool is_ghost) + bool is_ghost, + bool is_new) { void *local = talloc_new (NULL); notmuch_status_t status; const char *thread_id = NULL; /* Check if the message already had a thread ID */ - if (notmuch->features & NOTMUCH_FEATURE_GHOSTS) { + if (! is_new) { + thread_id = notmuch_message_get_thread_id (message); + } else if (notmuch->features & NOTMUCH_FEATURE_GHOSTS) { if (is_ghost) thread_id = notmuch_message_get_thread_id (message); } else { @@ -539,7 +542,7 @@ notmuch_database_index_file (notmuch_database_t *notmuch, } ret = _notmuch_database_link_message (notmuch, message, - message_file, is_ghost); + message_file, is_ghost, is_new); if (ret) goto DONE; diff --git a/lib/config.cc b/lib/config.cc index efab01e4..0b760dbc 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -133,8 +133,15 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch, *out = list; DONE: - if (status && list) - talloc_free (list); + if (status) { + if (list) { + talloc_free (list); + if (status != NOTMUCH_STATUS_XAPIAN_EXCEPTION) + _notmuch_config_list_destroy (list); + } + } else { + talloc_set_destructor (list, _notmuch_config_list_destroy); + } return status; } diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 57ec7f72..41aff342 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -31,6 +31,12 @@ #include "notmuch.h" +#include "xutil.h" +#include "error_util.h" +#include "string-util.h" +#include "crypto.h" +#include "repair.h" + NOTMUCH_BEGIN_DECLS #include @@ -47,14 +53,6 @@ NOTMUCH_BEGIN_DECLS #include -#include "gmime-extra.h" - -#include "xutil.h" -#include "error_util.h" -#include "string-util.h" -#include "crypto.h" -#include "repair.h" - #ifdef DEBUG # define DEBUG_DATABASE_SANITY 1 # define DEBUG_THREADING 1 diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh index 1ed5f28c..1951ef78 100755 --- a/test/T357-index-decryption.sh +++ b/test/T357-index-decryption.sh @@ -112,12 +112,10 @@ test_expect_equal \ "$expected" # try inserting it with decryption, should appear as a single copy -# (note: i think thread id skips 4 because of duplicate message-id -# insertion, above) test_begin_subtest "message cleartext is present with insert --decrypt=true" notmuch insert --folder=sent --decrypt=true <<<"$contents" -output=$(notmuch search wumpus) -expected='thread:0000000000000005 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox unread)' +output=$(notmuch search wumpus | notmuch_search_sanitize) +expected='thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox unread)' test_expect_equal \ "$output" \ "$expected" @@ -127,9 +125,9 @@ test_expect_equal \ test_begin_subtest 'tagging all messages' test_expect_success 'notmuch tag +blarney "encrypted message"' test_begin_subtest "verify that tags have not changed" -output=$(notmuch search tag:blarney) -expected='thread:0000000000000001 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) -thread:0000000000000005 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' +output=$(notmuch search tag:blarney | notmuch_search_sanitize) +expected='thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) +thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' test_expect_equal \ "$output" \ "$expected" @@ -138,14 +136,14 @@ test_expect_equal \ test_begin_subtest 'reindex old messages' test_expect_success 'notmuch reindex --decrypt=true tag:encrypted and not property:index.decryption=success' test_begin_subtest "reindexed encrypted message, including cleartext" -output=$(notmuch search wumpus) +output=$(notmuch search wumpus | notmuch_search_sanitize) test_expect_equal \ "$output" \ "$expected" # and the same search, but by property ($expected is untouched): test_begin_subtest "emacs search by property for both messages" -output=$(notmuch search property:index.decryption=success) +output=$(notmuch search property:index.decryption=success | notmuch_search_sanitize) test_expect_equal \ "$output" \ "$expected" @@ -154,7 +152,7 @@ test_expect_equal \ test_begin_subtest 'reindex in auto mode' test_expect_success 'notmuch reindex tag:encrypted and property:index.decryption=success' test_begin_subtest "reindexed encrypted messages, should not have changed" -output=$(notmuch search wumpus) +output=$(notmuch search wumpus | notmuch_search_sanitize) test_expect_equal \ "$output" \ "$expected" @@ -188,9 +186,9 @@ test_expect_equal \ # ensure that the tags remain even when we are dropping the cleartext. test_begin_subtest "verify that tags remain without cleartext" -output=$(notmuch search tag:blarney) -expected='thread:0000000000000001 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) -thread:0000000000000005 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' +output=$(notmuch search tag:blarney | notmuch_search_sanitize) +expected='thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 001 (blarney encrypted inbox) +thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (blarney encrypted inbox unread)' test_expect_equal \ "$output" \ "$expected" @@ -199,7 +197,7 @@ test_begin_subtest "index cleartext without keeping session keys" test_expect_success "notmuch reindex --decrypt=nostash tag:blarney" test_begin_subtest "Ensure that the indexed terms are present" -output=$(notmuch search wumpus) +output=$(notmuch search wumpus | notmuch_search_sanitize) test_expect_equal \ "$output" \ "$expected" diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh index b34f1e54..729b9d72 100755 --- a/test/T360-symbol-hiding.sh +++ b/test/T360-symbol-hiding.sh @@ -26,8 +26,9 @@ test_begin_subtest 'checking output' test_expect_equal "$result" "$output" test_begin_subtest 'comparing existing to exported symbols' -nm -P $NOTMUCH_BUILDDIR/lib/libnotmuch.so | awk '$2 == "T" && $1 ~ "^notmuch" {print $1}' | sort | uniq > ACTUAL -sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort | uniq > EXPORTED +readelf -Ws $NOTMUCH_BUILDDIR/lib/libnotmuch.so | sed -e 's/\[[^]]*\]//' |\ + awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $8}' | sort -u > ACTUAL +sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort -u > EXPORTED test_expect_equal_file EXPORTED ACTUAL test_done diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh index ac13d986..088e66dd 100755 --- a/test/T568-lib-thread.sh +++ b/test/T568-lib-thread.sh @@ -8,6 +8,11 @@ add_email_corpus test_begin_subtest "building database" test_expect_success "NOTMUCH_NEW" +test_begin_subtest "finding thread" +THREAD=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu) +count=$(notmuch count $THREAD) +test_expect_equal "$count" "7" + cat <<'EOF' > c_tail if (stat) { const char *stat_str = notmuch_database_status_string (db); @@ -30,7 +35,7 @@ int main (int argc, char** argv) notmuch_thread_t *thread = NULL; notmuch_threads_t *threads = NULL; notmuch_query_t *query = NULL; - const char *id = "thread:0000000000000009"; + const char *id = "${THREAD}"; stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg); if (stat != NOTMUCH_STATUS_SUCCESS) { @@ -52,10 +57,11 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} printf("%d\n%s\n", thread != NULL, id2); } EOF +thread_num=${THREAD#thread:} cat < EXPECTED == stdout == 1 -0000000000000009 +${thread_num} == stderr == EOF test_expect_equal_file EXPECTED OUTPUT diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh index 4e5672ab..7ae60595 100755 --- a/test/T670-duplicate-mid.sh +++ b/test/T670-duplicate-mid.sh @@ -6,6 +6,19 @@ add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1' add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2' add_message '[id]="duplicate"' '[subject]="message 0" [filename]=copy0' + +test_begin_subtest 'at most 1 thread-id per xapian document' +db=${MAIL_DIR}/.notmuch/xapian +for doc in $(xapian-delve -1 -t '' "$db" | grep '^[1-9]'); do + xapian-delve -1 -r "$doc" "$db" | grep -c '^G' +done > OUTPUT.raw +sort -u < OUTPUT.raw > OUTPUT +cat < EXPECTED +0 +1 +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest 'search: first indexed subject preserved' cat < EXPECTED thread:XXX 2001-01-05 [1/1(3)] Notmuch Test Suite; message 1 (inbox unread) diff --git a/version.txt b/version.txt index c415e1c6..a8a02172 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.31.2 +0.31.4