Re: [PATCH 3/5] lib: break reference loop by choosing arbitrary top level msg

Subject: Re: [PATCH 3/5] lib: break reference loop by choosing arbitrary top level msg

Date: Sun, 15 Apr 2018 00:38:43 -0700

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Daniel Kahn Gillmor


On Fri 2018-04-13 22:46:08 -0300, David Bremner wrote:
> Other parts of notmuch (e.g. notmuch show) expect each thread to
> contain at least one top level message, and crash if this expectation
> is not met.
> ---
>  lib/thread.cc    | 8 +++++++-
>  test/T050-new.sh | 1 -
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lib/thread.cc b/lib/thread.cc
> index 3561b27f..dbac002f 100644
> --- a/lib/thread.cc
> +++ b/lib/thread.cc
> @@ -397,7 +397,13 @@ _resolve_thread_relationships (notmuch_thread_t *thread)
>      for (node = thread->message_list->head; node; node = node->next) {
>  	message = node->message;
>  	in_reply_to = _notmuch_message_get_in_reply_to (message);
> -	if (in_reply_to && strlen (in_reply_to) &&
> +	/*
> +	 * if we reach the end of the list without finding a top-level
> +	 * message, that means the thread is a cycle (or set of
> +	 * cycles) and any message can be considered top-level
> +	 */

Just how arbitrary should we be?  Do we want it to be non-deterministic?

If we care about determinism, i'd recommend selecting the message with
the earliest date as the top-level message, and if multiple messages
have the same date, we should sort by Message-ID.

     --dkg
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: