]> git.ipfire.org Git - thirdparty/public-inbox.git/commit
*index: ignore misordered References if In-Reply-To exists
authorEric Wong <e@80x24.org>
Fri, 22 Aug 2025 20:40:25 +0000 (20:40 +0000)
committerEric Wong <e@80x24.org>
Mon, 25 Aug 2025 01:16:40 +0000 (01:16 +0000)
commitba85cb5565a8824dde480d59d85087d6f94666a2
treed5c295366cdfd9f167a3fbe53b82223e8a74d849
parentd4d7efc3087db32f739120c9f05b9d8fb82622c0
*index: ignore misordered References if In-Reply-To exists

Fix our indexers to favor In-Reply-To during the Message-ID
unique-fication phase.  Some MUAs will generate an incorrect
References header ordering and put its direct In-Reply-To at the
head of the References list instead of at the tail.

Having the same Message-ID in both References and In-Reply-To
inadvertently caused the In-Reply-To value to get dropped by the
`uniq_mids' subroutine.  To fix this, we reverse the values
before `uniq_mids' and reverse the result again since
PublicInbox::SearchThread (and Mail::Thread before) depends on
the In-Reply-To being last.

An expensive(*) --rethread --reindex will be required to fix
this on the existing data set.  I've only tested this change
with a three message inbox consisting of the following
Message-IDs:

<153126248868.14533.9751473662727327569.stgit@warthog.procyon.org.uk>
<CA+55aFzEjPUGZFk7PnM0T6YEn5uRrscgyCHyhc_cYz0m8ejdLA@mail.gmail.com>
<29128.1531356361@warthog.procyon.org.uk>

Where <29128.1531356361@warthog.procyon.org.uk> is the message
with the out-of-order References header.

(*) - reindexing lore/all would take days or even a week :<

Reported-by: Askar Safin <safinaskar@zohomail.com>
Link: https://public-inbox.org/meta/198d28845f7.bd9650eb4485.7082558303836689927@zohomail.com/
Link: https://lore.kernel.org/linux-fsdevel/29128.1531356361@warthog.procyon.org.uk/raw
lib/PublicInbox/MID.pm