unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Franz Fellner <alpine.art.de@gmail.com>
To: David Bremner <david@tethera.net>,
	David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org
Subject: Re: [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms
Date: Mon, 04 May 2020 18:16:54 +0300	[thread overview]
Message-ID: <1588605414-ner-8.194@TPL520> (raw)
In-Reply-To: <20200504140024.1617656-2-david@tethera.net>

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
> 
> 
> 
-- 

  reply	other threads:[~2020-05-04 16:57 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         ` [PATCH 2/2] lib: replace STRNCMP_LITERAL in __message_remove_indexed_terms David Bremner
2020-05-04 15:16           ` Franz Fellner [this message]
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=1588605414-ner-8.194@TPL520 \
    --to=alpine.art.de@gmail.com \
    --cc=david@tethera.net \
    --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).