From: David Bremner <david@tethera.net>
To: David Bremner <david@tethera.net>,
Franz Fellner <alpine.art.de@gmail.com>,
notmuch@notmuchmail.org
Subject: [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms
Date: Mon, 4 May 2020 11:00:24 -0300 [thread overview]
Message-ID: <20200504140024.1617656-2-david@tethera.net> (raw)
In-Reply-To: <20200504140024.1617656-1-david@tethera.net>
strncmp looks for a prefix that matches, which is very much not what
we want here. This fixes the bug reported by Franz Fellner in
id:1588595993-ner-8.651@TPL520
---
lib/message.cc | 6 +++---
test/T700-reindex.sh | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/message.cc b/lib/message.cc
index 5c9b58b2..0fa0eb3a 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -751,9 +751,9 @@ _notmuch_message_remove_indexed_terms (notmuch_message_t *message)
const char *tag = notmuch_tags_get (tags);
- if (STRNCMP_LITERAL (tag, "encrypted") != 0 &&
- STRNCMP_LITERAL (tag, "signed") != 0 &&
- STRNCMP_LITERAL (tag, "attachment") != 0) {
+ if (strcmp (tag, "encrypted") != 0 &&
+ strcmp (tag, "signed") != 0 &&
+ strcmp (tag, "attachment") != 0) {
std::string term = tag_prefix + tag;
message->doc.add_term (term);
}
diff --git a/test/T700-reindex.sh b/test/T700-reindex.sh
index 7b7e52de..3d7c930d 100755
--- a/test/T700-reindex.sh
+++ b/test/T700-reindex.sh
@@ -34,7 +34,6 @@ notmuch dump > OUTPUT
test_expect_equal_file initial-dump OUTPUT
test_begin_subtest 'reindex preserves tags with special prefixes'
-test_subtest_known_broken
notmuch tag +attachment2 +encrypted2 +signed2 '*'
notmuch dump > EXPECTED
notmuch reindex '*'
--
2.26.2
next prev parent reply other threads:[~2020-05-04 14:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 7:25 notmuch reindex wipes existing tags Franz Fellner
2020-05-04 10:30 ` David Bremner
2020-05-04 12:39 ` Franz Fellner
2020-05-04 13:39 ` David Bremner
2020-05-04 14:00 ` [PATCH 1/2] test: known broken test for reindex tag preservation David Bremner
2020-05-04 14:00 ` David Bremner [this message]
2020-05-04 15:16 ` [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms Franz Fellner
2020-05-04 14:16 ` [PATCH 1/2] test: known broken test for reindex tag preservation Tomi Ollila
2020-05-04 22:47 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200504140024.1617656-2-david@tethera.net \
--to=david@tethera.net \
--cc=alpine.art.de@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).