isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 95a22739fa16435d5d709c5a3bfc8e466ee8d1d2
parent 1631361f66162f0a85bdc3543bf72406b93d0cb1
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Wed, 29 Dec 2021 14:42:22 +0100

don't UID EXPUNGE too many messages

we didn't check that the UIDs are adjacent, so we might have caught
not fetched deleted messages between two fetched messages below the
bulk load range.

checking adjacency of UIDs would make expunges in the bulk range (which
is likely to be full of holes) rather inefficient. so we use sequence
numbers instead.

this is admittedly a rather academical fix ...

amends 18225344.

Diffstat:
Msrc/drv_imap.c | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c @@ -3128,7 +3128,18 @@ imap_close_box( store_t *gctx, buf[bl++] = ','; bl += sprintf( buf + bl, "%u", msg->uid ); fmsg = msg; - for (; (nmsg = msg->next) && (nmsg->flags & F_DELETED); msg = nmsg) {} + for (; (nmsg = msg->next); msg = nmsg) { + if (nmsg->status & M_DEAD) { + // Messages that jump a gap interrupt the range, even expunged ones. + if (nmsg->seq) + break; + } else { + if (nmsg->seq > 1) + break; + if (!(nmsg->flags & F_DELETED)) + break; + } + } if (msg != fmsg) bl += sprintf( buf + bl, ":%u", msg->uid ); }