Browse Source

fix off-by-one when loading messages outside the bulk range

this would lead to a bogus deletion being propagated to the near side.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
3febb16fd5
  1. 22
      src/run-tests.pl
  2. 2
      src/sync.c

22
src/run-tests.pl

@ -1246,6 +1246,28 @@ my @X34 = (
); );
test("max messages + expire - new", \@x33, \@X34, \@O34); test("max messages + expire - new", \@x33, \@X34, \@O34);
my @x35 = (
B, 0, B,
A, "*F", "*F", "*F",
B, "*", "*", "*",
C, "*", "", "",
D, "*", "", "",
E, "*", "", "",
F, "*", "", "",
G, "*", "", "",
H, "*", "", "",
);
my @O35 = ("", "", "Sync New\nMaxMessages 3\nExpireUnread yes\n");
my @X35 = (
H, E, H,
B, "", "+~", "+T",
F, "", "*", "*",
G, "", "*", "*",
H, "", "*", "*",
);
test("max messages + expire - too many new", \@x35, \@X35, \@O35);
my @x38 = ( my @x38 = (
F, C, 0, F, C, 0,
A, "*FS", "*FS", "*S", A, "*FS", "*FS", "*S",

2
src/sync.c

@ -813,7 +813,7 @@ box_opened2( sync_vars_t *svars, int t )
continue; // No message; other state is irrelevant continue; // No message; other state is irrelevant
if (srec->uid[F] >= minwuid) if (srec->uid[F] >= minwuid)
continue; // Message is in non-expired range continue; // Message is in non-expired range
if ((svars->opts[F] & OPEN_NEW) && srec->uid[F] >= svars->maxuid[F]) if ((svars->opts[F] & OPEN_NEW) && srec->uid[F] > svars->maxuid[F])
continue; // Message is in expired range, but new range overlaps that continue; // Message is in expired range, but new range overlaps that
if (!srec->uid[N] && !(srec->status & S_PENDING)) if (!srec->uid[N] && !(srec->status & S_PENDING))
continue; // Only actually paired up messages matter continue; // Only actually paired up messages matter

Loading…
Cancel
Save