From e6a15bee596eda747a016c9c52b27761c1632350 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 20 Feb 2022 12:39:19 +0100 Subject: [PATCH] make sure we fetch source flags when expiring while pulling new otherwise important messages may be incorrectly aborted. --- src/run-tests.pl | 7 ++++--- src/sync.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/run-tests.pl b/src/run-tests.pl index 18c3cac..7d00f8d 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -1251,20 +1251,21 @@ my @x35 = ( A, "*F", "*F", "*F", B, "*", "*", "*", C, "*", "", "", - D, "*", "", "", + D, "*F", "", "", E, "*", "", "", F, "*", "", "", G, "*", "", "", - H, "*", "", "", + H, "*F", "", "", ); my @O35 = ("", "", "Sync New\nMaxMessages 3\nExpireUnread yes\n"); my @X35 = ( H, E, H, B, "", "+~", "+T", + D, "", "*F", "*F", F, "", "*", "*", G, "", "*", "*", - H, "", "*", "*", + H, "", "*F", "*F", ); test("max messages + expire - too many new", \@x35, \@X35, \@O35); diff --git a/src/sync.c b/src/sync.c index 2625c74..b84efc0 100644 --- a/src/sync.c +++ b/src/sync.c @@ -792,6 +792,8 @@ box_opened2( sync_vars_t *svars, int t ) svars->any_expiring = 1; if (svars->any_expiring) { opts[N] |= OPEN_OLD | OPEN_FLAGS; + if (chan->ops[N] & (OP_NEW | OP_RENEW)) + opts[F] |= OPEN_FLAGS; } svars->opts[F] = svars->drv[F]->prepare_load_box( ctx[F], opts[F] ); svars->opts[N] = svars->drv[N]->prepare_load_box( ctx[N], opts[N] );