]> git.notmuchmail.org Git - notmuch/commitdiff
lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms
authorDavid Bremner <david@tethera.net>
Mon, 4 May 2020 13:55:43 +0000 (10:55 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 4 May 2020 13:55:43 +0000 (10:55 -0300)
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
test/T700-reindex.sh

index 5c9b58b22986cd9fff286e3493dffedc2ade7450..0fa0eb3aef531237a01a2a19d73847a38fe49fff 100644 (file)
@@ -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);
        }
index 7b7e52deb55b5f8389085b8daca65160f6d17cb8..3d7c930d6bdb0fe557b665c76385e5343478d541 100755 (executable)
@@ -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 '*'