From dab32dc70c15789b188001b78b7225c61bed4784 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 15 May 2021 15:40:22 -0300 Subject: [PATCH 01/16] lib/n_d_index_file: re-use thread-id of existing message This prevents the message document getting multiple thread-id terms when there are multiple files with the same message-id. This change shifts some thread ids, requiring adjustments to other tests. (cherry picked from commit 3f4de98e7c8c70f9a86a4f899147126f79907bd9) --- lib/add-message.cc | 9 ++++++--- test/T357-index-decryption.sh | 26 ++++++++++++-------------- test/T670-duplicate-mid.sh | 13 +++++++++++++ 3 files changed, 31 insertions(+), 17 deletions(-) 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/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/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) From dd5cd144766dffc8a36fa3b3f00f8e194c2e4d14 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 26 Jun 2021 22:44:36 -0300 Subject: [PATCH 02/16] changelog for 0.31.4-2 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index ec3de63d..382c8184 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +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. + + -- David Bremner Sat, 26 Jun 2021 22:44:08 -0300 + notmuch (0.31.4-1) unstable; urgency=medium * New upstream bugfix release From 3f102654c6e51c68cbc26bfd2195d2a19b72de3c Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 28 Jun 2021 22:09:54 -0300 Subject: [PATCH 03/16] debian/changelog: refinalize for upload --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 382c8184..d767fb4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,7 @@ notmuch (0.31.4-2) unstable; urgency=medium duplicate message-ids can cause multiple thread-ids for some message documents. - -- David Bremner Sat, 26 Jun 2021 22:44:08 -0300 + -- David Bremner Mon, 28 Jun 2021 22:09:09 -0300 notmuch (0.31.4-1) unstable; urgency=medium From fef433f30700445ce04ff702681e81e979cc307a Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 24 Apr 2021 12:13:37 -0300 Subject: [PATCH 04/16] debian: add xapian-tools for tests xapian-metadata is used by some of the new tests. (cherry picked from commit 9f8458a998a0a20f435b5d47ac085acb9490ddae) --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 8b34d9ed..633d0be8 100644 --- a/debian/control +++ b/debian/control @@ -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 From 7b6f1b0f08230b51c8b90b169716aaa463402cd5 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 28 Jun 2021 22:44:24 -0300 Subject: [PATCH 05/16] Commit Debian 3.0 (quilt) metadata [dgit (9.13) quilt-fixup] --- debian/patches/debian-changes | 136 ++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 137 insertions(+) create mode 100644 debian/patches/debian-changes create mode 100644 debian/patches/series 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 From b6cfc8a61c20aec1e54185829718f87c7f7dea79 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Mon, 28 Jun 2021 22:48:29 -0300 Subject: [PATCH 06/16] debian: document new build-dependency --- debian/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d767fb4b..ebfd9209 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ 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:09:09 -0300 + -- David Bremner Mon, 28 Jun 2021 22:48:02 -0300 notmuch (0.31.4-1) unstable; urgency=medium From 414ba75c81133fb9b6390d79bd40e3d8fb83a269 Mon Sep 17 00:00:00 2001 From: Austin Ray Date: Sat, 14 Aug 2021 18:39:17 -0400 Subject: [PATCH 07/16] lib: correct deprecated db open functions' docs Both notmuch_database_open() and notmuch_database_open_verbose()'s documentation state they call notmuch_database_open_with_config() with config_path=NULL; however, their implementations pass an empty string. The empty string is the correct value to maintain their original behavior of not loading the user's configuration so their documentation is incorrect. --- lib/notmuch.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notmuch.h b/lib/notmuch.h index 4b053932..c0fa1768 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -316,7 +316,7 @@ typedef enum { /** * Deprecated alias for notmuch_database_open_with_config with - * config_path=error_message=NULL + * config_path="" and error_message=NULL * @deprecated Deprecated as of libnotmuch 5.4 (notmuch 0.32) */ /* NOTMUCH_DEPRECATED(5, 4) */ @@ -326,7 +326,7 @@ notmuch_database_open (const char *path, notmuch_database_t **database); /** * Deprecated alias for notmuch_database_open_with_config with - * config_path=NULL + * config_path="" * * @deprecated Deprecated as of libnotmuch 5.4 (notmuch 0.32) * From f1a310b3a9b2487b7c6e3a74fa2157b96cd567a0 Mon Sep 17 00:00:00 2001 From: Austin Ray Date: Fri, 13 Aug 2021 12:50:28 -0400 Subject: [PATCH 08/16] lib: bump libnotmuch minor version Notmuch 0.32 corresponds to libnotmuch 5.4 as indicated by docstrings; however, the minor number wasn't bumped. Any libnotmuch downstream consumer using the LIBNOTMUCH_CHECK_VERSION macro to support multiple versions won't be able to access the new 5.4 functions. Signed-off-by: Austin Ray --- lib/notmuch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/notmuch.h b/lib/notmuch.h index c0fa1768..15390610 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -58,7 +58,7 @@ NOTMUCH_BEGIN_DECLS * version in Makefile.local. */ #define LIBNOTMUCH_MAJOR_VERSION 5 -#define LIBNOTMUCH_MINOR_VERSION 3 +#define LIBNOTMUCH_MINOR_VERSION 4 #define LIBNOTMUCH_MICRO_VERSION 0 From 8376e814412f8165b781aa21dac654c2fc948306 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 4 Aug 2021 07:42:34 -0300 Subject: [PATCH 09/16] test: add known broken tests for finding database via MAILDIR This highlights a bug reported by several users, including Mohsin Kaleem [1]. The inconsistent use of test_begin_subtest_known_broken is because some of these tests pass even though the database cannot be located. This problem is left for a future commit. [1]: id:87bl9lx864.fsf@kisara.moe --- test/T055-path-config.sh | 44 ++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index 8ef76aed..7c7d81b1 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -16,6 +16,7 @@ restore_config () { unset DATABASE_PATH unset NOTMUCH_PROFILE unset XAPIAN_PATH + unset MAILDIR rm -f "$HOME/mail" cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG} } @@ -55,6 +56,18 @@ home_mail_config () { unset DATABASE_PATH } +maildir_env_config () { + local dir + backup_config + dir="${HOME}/env_points_here" + ln -s $MAIL_DIR $dir + export MAILDIR=$dir + notmuch config set database.path + notmuch config set database.mail_root + XAPIAN_PATH="${MAIL_DIR}/.notmuch/xapian" + unset DATABASE_PATH +} + xdg_config () { local dir local profile=${1:-default} @@ -79,7 +92,7 @@ xdg_config () { notmuch --config=${CONFIG_PATH} config set database.path } -for config in traditional split XDG XDG+profile symlink home_mail; do +for config in traditional split XDG XDG+profile symlink home_mail maildir_env; do #start each set of tests with an known set of messages add_email_corpus @@ -106,13 +119,18 @@ for config in traditional split XDG XDG+profile symlink home_mail; do home_mail) home_mail_config ;; + maildir_env) + maildir_env_config + ;; esac test_begin_subtest "count ($config)" + [[ "$config" = maildir_env ]] && test_subtest_known_broken output=$(notmuch count '*') test_expect_equal "$output" '52' test_begin_subtest "count+tag ($config)" + [[ "$config" = maildir_env ]] && test_subtest_known_broken tag="tag${RANDOM}" notmuch tag +$tag '*' output=$(notmuch count tag:$tag) @@ -120,6 +138,7 @@ for config in traditional split XDG XDG+profile symlink home_mail; do test_expect_equal "$output" '52' test_begin_subtest "address ($config)" + [[ "$config" = maildir_env ]] && test_subtest_known_broken notmuch address --deduplicate=no --sort=newest-first --output=sender --output=recipients path:foo >OUTPUT cat <EXPECTED Carl Worth @@ -128,6 +147,7 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "dump ($config)" + [[ "$config" = maildir_env ]] && test_subtest_known_broken notmuch dump is:attachment and is:signed | sort > OUTPUT cat < EXPECTED #notmuch-dump batch-tag:3 config,properties,tags @@ -150,16 +170,19 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "use existing database ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken output=$(notmuch new) test_expect_equal "$output" 'No new mail.' test_begin_subtest "create database ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken rm -rf $DATABASE_PATH/{.notmuch,}/xapian notmuch new output=$(notmuch count '*') test_expect_equal "$output" '52' test_begin_subtest "detect new files ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken generate_message generate_message notmuch new @@ -167,12 +190,14 @@ EOF test_expect_equal "$output" '54' test_begin_subtest "Show a raw message ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken add_message notmuch show --format=raw id:$gen_msg_id > OUTPUT test_expect_equal_file $gen_msg_filename OUTPUT rm -f $gen_msg_filename test_begin_subtest "reply ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken add_message '[from]="Sender "' \ [to]=test_suite@notmuchmail.org \ [subject]=notmuch-reply-test \ @@ -190,7 +215,9 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender wrote: > basic reply test EOF test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "insert+search ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken generate_message \ "[subject]=\"insert-subject\"" \ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ @@ -208,6 +235,7 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "upgrade backup ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken features=$(xapian-metadata get $XAPIAN_PATH features | grep -v "^relative directory paths") xapian-metadata set $XAPIAN_PATH features "$features" output=$(notmuch new | grep Welcome) @@ -241,6 +269,7 @@ EOF test_expect_equal "${output}+${output2}" "${value}+" test_begin_subtest "Set config value in database ($config)" + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken name=${RANDOM} value=${RANDOM} notmuch config set --database test${test_count}.${name} ${value} @@ -250,11 +279,14 @@ EOF test_expect_equal "${output}+${output2}" "${value}+" test_begin_subtest "Config list ($config)" - notmuch config list | notmuch_dir_sanitize | sed -e "s/^database.backup_dir=.*$/database.backup_dir/" \ - -e "s/^database.hook_dir=.*$/database.hook_dir/" \ - -e "s/^database.path=.*$/database.path/" \ - -e "s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \ - > OUTPUT + [[ "$config" = "maildir_env" ]] && test_subtest_known_broken + notmuch config list | notmuch_dir_sanitize | \ + sed -e "s/^database.backup_dir=.*$/database.backup_dir/" \ + -e "s/^database.hook_dir=.*$/database.hook_dir/" \ + -e "s/^database.path=.*$/database.path/" \ + -e "s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \ + -e "s,^database.mail_root=CWD/home/env_points_here,database.mail_root=MAIL_DIR," \ + > OUTPUT cat < EXPECTED built_with.compact=true built_with.field_processor=true From d9300116909ea316c84fd6d3ee57c89074dcd260 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 4 Aug 2021 07:42:35 -0300 Subject: [PATCH 10/16] lib/open: look in MAILDIR for database, as documented. This fixes the bug id:87bl9lx864.fsf@kisara.moe --- lib/open.cc | 4 ++++ test/T055-path-config.sh | 13 ------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index 3325e725..13743459 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -220,6 +220,10 @@ _choose_database_path (void *ctx, } } + if (! *database_path) { + *database_path = getenv ("MAILDIR"); + } + if (! *database_path) { notmuch_status_t status; diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index 7c7d81b1..3e782f65 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -125,12 +125,10 @@ for config in traditional split XDG XDG+profile symlink home_mail maildir_env; d esac test_begin_subtest "count ($config)" - [[ "$config" = maildir_env ]] && test_subtest_known_broken output=$(notmuch count '*') test_expect_equal "$output" '52' test_begin_subtest "count+tag ($config)" - [[ "$config" = maildir_env ]] && test_subtest_known_broken tag="tag${RANDOM}" notmuch tag +$tag '*' output=$(notmuch count tag:$tag) @@ -138,7 +136,6 @@ for config in traditional split XDG XDG+profile symlink home_mail maildir_env; d test_expect_equal "$output" '52' test_begin_subtest "address ($config)" - [[ "$config" = maildir_env ]] && test_subtest_known_broken notmuch address --deduplicate=no --sort=newest-first --output=sender --output=recipients path:foo >OUTPUT cat <EXPECTED Carl Worth @@ -147,7 +144,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "dump ($config)" - [[ "$config" = maildir_env ]] && test_subtest_known_broken notmuch dump is:attachment and is:signed | sort > OUTPUT cat < EXPECTED #notmuch-dump batch-tag:3 config,properties,tags @@ -170,19 +166,16 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "use existing database ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken output=$(notmuch new) test_expect_equal "$output" 'No new mail.' test_begin_subtest "create database ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken rm -rf $DATABASE_PATH/{.notmuch,}/xapian notmuch new output=$(notmuch count '*') test_expect_equal "$output" '52' test_begin_subtest "detect new files ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken generate_message generate_message notmuch new @@ -190,14 +183,12 @@ EOF test_expect_equal "$output" '54' test_begin_subtest "Show a raw message ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken add_message notmuch show --format=raw id:$gen_msg_id > OUTPUT test_expect_equal_file $gen_msg_filename OUTPUT rm -f $gen_msg_filename test_begin_subtest "reply ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken add_message '[from]="Sender "' \ [to]=test_suite@notmuchmail.org \ [subject]=notmuch-reply-test \ @@ -217,7 +208,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "insert+search ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken generate_message \ "[subject]=\"insert-subject\"" \ "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ @@ -235,7 +225,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "upgrade backup ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken features=$(xapian-metadata get $XAPIAN_PATH features | grep -v "^relative directory paths") xapian-metadata set $XAPIAN_PATH features "$features" output=$(notmuch new | grep Welcome) @@ -269,7 +258,6 @@ EOF test_expect_equal "${output}+${output2}" "${value}+" test_begin_subtest "Set config value in database ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken name=${RANDOM} value=${RANDOM} notmuch config set --database test${test_count}.${name} ${value} @@ -279,7 +267,6 @@ EOF test_expect_equal "${output}+${output2}" "${value}+" test_begin_subtest "Config list ($config)" - [[ "$config" = "maildir_env" ]] && test_subtest_known_broken notmuch config list | notmuch_dir_sanitize | \ sed -e "s/^database.backup_dir=.*$/database.backup_dir/" \ -e "s/^database.hook_dir=.*$/database.hook_dir/" \ From 202dde04e1057d0ab06a4e11f059f9ed2c6a717f Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 18 Jul 2021 14:58:21 -0300 Subject: [PATCH 11/16] test/config: add tests for built_with The "get" test is known broken because this functionality was dropped during the 0.32 config rewrite. --- test/T030-config.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/T030-config.sh b/test/T030-config.sh index 7a1660e9..bc9904b8 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -144,4 +144,23 @@ notmuch config set --database ${key} ${value} output=$(notmuch config get ${key}) test_expect_equal "${output}" "${value}" +test_begin_subtest "set built_with.* yields error" +test_expect_code 1 "notmuch config set built_with.compact false" + +test_begin_subtest "get built_with.{compact,field_processor} prints true" +test_subtest_known_broken +for key in compact field_processor; do + notmuch config get built_with.${key} +done > OUTPUT +cat < EXPECTED +true +true +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "get built_with.nonexistent prints false" +test_subtest_known_broken +output=$(notmuch config get built_with.nonexistent) +test_expect_equal "$output" "false" + test_done From 686230712f3865ac0d0250084113d6d859cc2519 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 18 Jul 2021 14:58:22 -0300 Subject: [PATCH 12/16] CLI/config: restore "notmuch config get built_with.*" We need to special case the config section "built_with" because it is not (currently) handled by the library. This seems consist with the other sub-sub-commands 'list' and 'set'. --- notmuch-config.c | 17 ++++++++++++----- test/T030-config.sh | 2 -- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/notmuch-config.c b/notmuch-config.c index d9390c4d..e5b4db45 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -538,11 +538,18 @@ notmuch_config_command_get (notmuch_database_t *notmuch, char *item) { notmuch_config_values_t *list; - for (list = notmuch_config_get_values_string (notmuch, item); - notmuch_config_values_valid (list); - notmuch_config_values_move_to_next (list)) { - const char *val = notmuch_config_values_get (list); - puts (val); + if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) { + if (notmuch_built_with (item + strlen (BUILT_WITH_PREFIX))) + puts ("true"); + else + puts ("false"); + } else { + for (list = notmuch_config_get_values_string (notmuch, item); + notmuch_config_values_valid (list); + notmuch_config_values_move_to_next (list)) { + const char *val = notmuch_config_values_get (list); + puts (val); + } } return EXIT_SUCCESS; } diff --git a/test/T030-config.sh b/test/T030-config.sh index bc9904b8..f8897471 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -148,7 +148,6 @@ test_begin_subtest "set built_with.* yields error" test_expect_code 1 "notmuch config set built_with.compact false" test_begin_subtest "get built_with.{compact,field_processor} prints true" -test_subtest_known_broken for key in compact field_processor; do notmuch config get built_with.${key} done > OUTPUT @@ -159,7 +158,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "get built_with.nonexistent prints false" -test_subtest_known_broken output=$(notmuch config get built_with.nonexistent) test_expect_equal "$output" "false" From 2e6089caabb6d35ab32cae87470394c2942cc452 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 17 Aug 2021 17:02:21 -0700 Subject: [PATCH 13/16] NEWS: news for 0.32.3 --- NEWS | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/NEWS b/NEWS index 76fca9bd..b826d280 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,23 @@ +Notmuch 0.32.3 (2021-08-17) +=========================== + +Library +------- + +Restore location of database via `MAILDIR` environment variable, which +was broken in 0.32. + +Bump libnotmuch minor version to match the documentation in +`notmuch.h`. + +Correct documentation for deprecated database opening functions to +point out that they (still) do not load configuration information. + +CLI +--- + +Restore "notmuch config get built_with.*", which was broken in 0.32. + Notmuch 0.32.2 (2021-06-27) =========================== From c8ef3a944303dd0ce9e3f2e1ea55822a4a43d19f Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 17 Aug 2021 17:12:27 -0700 Subject: [PATCH 14/16] version: bump to 0.32.3 --- bindings/python-cffi/version.txt | 2 +- bindings/python/notmuch/version.py | 2 +- version.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/python-cffi/version.txt b/bindings/python-cffi/version.txt index 989b29cc..d721c768 100644 --- a/bindings/python-cffi/version.txt +++ b/bindings/python-cffi/version.txt @@ -1 +1 @@ -0.32.2 +0.32.3 diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py index de104bfa..e10408ac 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.32.2' +__VERSION__ = '0.32.3' SOVERSION = '5' diff --git a/version.txt b/version.txt index 989b29cc..d721c768 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.32.2 +0.32.3 From 3f30ee65efec7c35e56af36eaa49af5c2e220d8f Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 17 Aug 2021 17:18:21 -0700 Subject: [PATCH 15/16] debian: changelog for 0.32.3-1 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 903c1f94..05d7bec0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +notmuch (0.32.3-1) unstable; urgency=medium + + * new upstream bugfix release + * fixes for a few configuration related bugs introduced in 0.32 + * bump libnotmuch minor version to match documentation. + + -- David Bremner Tue, 17 Aug 2021 17:16:09 -0700 + notmuch (0.32.2-1) experimental; urgency=medium * New upstream bugfix release From 34fec91e17629a6a095bd5930e020dfeaddff245 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 17 Aug 2021 22:05:32 -0700 Subject: [PATCH 16/16] debian: drop patches The relevant changes are of the 0.32.2 release --- debian/patches/debian-changes | 136 ---------------------------------- debian/patches/series | 1 - 2 files changed, 137 deletions(-) delete mode 100644 debian/patches/debian-changes delete mode 100644 debian/patches/series diff --git a/debian/patches/debian-changes b/debian/patches/debian-changes deleted file mode 100644 index d6927fd0..00000000 --- a/debian/patches/debian-changes +++ /dev/null @@ -1,136 +0,0 @@ -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 deleted file mode 100644 index 7bb82529..00000000 --- a/debian/patches/series +++ /dev/null @@ -1 +0,0 @@ -debian-changes