Re: [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms

Subject: Re: [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms

Date: Mon, 04 May 2020 18:16:54 +0300

To: David Bremner, David Bremner, notmuch@notmuchmail.org

Cc:

From: Franz Fellner


Thank you very much.
I confirm that the patch fixes the issue.

Regards
Franz

On Mon May  4 11:00:24 2020, David Bremner <david@tethera.net> wrote:
> 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
> 
> 
> 
-- 
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: