unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Franz Fellner <alpine.art.de@gmail.com>
To: Lucas <luc.lists@gmail.com>, notmuch@notmuchmail.org
Subject: Re: Bug: counting messages twice after excluding tags yields different results
Date: Wed, 31 Aug 2016 09:21:18 +0000	[thread overview]
Message-ID: <1.472.635.278-ner-3.934@TP_L520> (raw)
In-Reply-To: <147263183913.27784.12274024193186585889@mbp>

Your problem: the example sucks ;)
If the query searches for a tag you also have in exclude_tags (in your case: spam) the exclude gets ignored.
Change your query to just "is:inbox" and magically "spam" really gets excluded.

However it is better to create fresh query objects for each new query. I remember there are operations on query objects that are destructive. That's why users of the notmuch API usually create seperate queriy objects for counting messages/threads and getting the results.

On Wed, 31 Aug 2016 10:23:59 +0200, Lucas <luc.lists@gmail.com> wrote:
> Dear list members,
> 
> I think I found a bug or at least undocumented behaviour in the notmuch
> library.  I would like to report this here.  Originally I found the bug
> in the python library but I attached a c program that shows the same
> behaviour.  I am running notmuch version 0.22.1 from the Arch Linux
> repositories.
> 
> The setup:
> 1. chose a query string, e.g. "is:inbox or is:spam"
> 2. chose a tag to exclude that is matched by the query, e.g. "spam"
> 3. open the database
> 4. create a query
> 5. check the message or thread count any number of times
> 6. exclude the tag from the query
> 7. check the message or thread count any number of times
> 
> The result:
> - In step 5 the result stays the same if I repeatedly call
>   notmuch_query_count_messages_st or query.count_messages.
> - In step 7 the count is different between the first call and all
>   subsequent calls.  But neither seems correct to me.  I always get the
>   same number as in step 5 for the first call and 0 afterwards.
> 
> Expected result:
> - subsequent calls to notmuch_query_count_messages_st or
>   query.count_messages should yield the same result
> - the exclusion should change the count to the actual amount (for
>   "is:inbox or is:spam" I get 891 and for a plain "is:inbox" I get 58,
>   which never shows up in step 7)
> 
> Attached you can find a python and a c program that exhibit this
> behaviour.  Please compile the c program with
> 
> cc -DDB_PATH=\"/path/to/your/mail\" -lnotmuch test.c
> 
> My question:
> Is this documented somewhere?  Is it actually a bug or is it already
> fixed in a newer version?
> 
> Thank you for developing notmuch!
> 
> Lucas
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
> 
> 
-- 

  reply	other threads:[~2016-08-31  9:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31  8:23 Bug: counting messages twice after excluding tags yields different results Lucas
2016-08-31  9:21 ` Franz Fellner [this message]
2016-08-31 11:16   ` Lucas Hoffmann
2016-08-31 12:20     ` David Bremner
2016-08-31 12:56       ` Franz Fellner
2016-09-01  1:16         ` David Bremner
2016-09-03 12:50           ` [PATCH] lib doc: group query functions, add disclaimer David Bremner
2016-09-05 10:57 ` Bug: counting messages twice after excluding tags yields different results David Bremner
2017-03-05 11:41 ` 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=1.472.635.278-ner-3.934@TP_L520 \
    --to=alpine.art.de@gmail.com \
    --cc=luc.lists@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).