Browse Source

fix bogus orphaning due to expunging

we cannot orphan all messages whose opposite we expunge, as that would
prevent subsequent propagation of the deletion. we can do that only if
the message is already known to be marked as deleted.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
f2f519e20b
  1. 20
      src/run-tests.pl
  2. 4
      src/sync.c

20
src/run-tests.pl

@ -1064,6 +1064,26 @@ my @X08 = (
); );
test("push flags + pull deletions", \@x01, \@X08, \@O08); test("push flags + pull deletions", \@x01, \@X08, \@O08);
my @O09 = ("", "", "Sync None\nExpunge Both\n");
my @X09 = (
I, 0, I,
E, "/", "", "",
F, "", "", "/",
H, "/", "", "",
J, "/", "", "",
L, "", "", "/",
);
test("noop + expunge both", \@x01, \@X09, \@O09);
my @O0A = ("", "", "Sync None\nExpunge Near\n");
# Sync entries are not updated/pruned, because the far side is not loaded.
my @X0A = (
I, 0, I,
F, "", "", "/",
L, "", "", "/",
);
test("noop + expunge near side", \@x01, \@X0A, \@O0A);
# Size restriction tests # Size restriction tests
my @x20 = ( my @x20 = (

4
src/sync.c

@ -1812,11 +1812,11 @@ box_closed_p2( sync_vars_t *svars, int t )
((srec->status & S_EXPIRED) && svars->maxuid[F] >= srec->uid[F] && svars->maxxfuid >= srec->uid[F])) { ((srec->status & S_EXPIRED) && svars->maxuid[F] >= srec->uid[F] && svars->maxxfuid >= srec->uid[F])) {
PC_JLOG( "- %u %u", (srec->uid[F], srec->uid[N]), "killing" ); PC_JLOG( "- %u %u", (srec->uid[F], srec->uid[N]), "killing" );
srec->status = S_DEAD; srec->status = S_DEAD;
} else if (srec->uid[N]) { } else if (srec->uid[N] && (srec->status & S_DEL(F))) {
PC_JLOG( "> %u %u 0", (srec->uid[F], srec->uid[N]), "orphaning" ); PC_JLOG( "> %u %u 0", (srec->uid[F], srec->uid[N]), "orphaning" );
srec->uid[N] = 0; srec->uid[N] = 0;
} }
} else if (srec->uid[F] && ((srec->status & S_DEL(F)) && (svars->state[F] & ST_DID_EXPUNGE))) { } else if (srec->uid[F] && ((srec->status & S_DEL(F)) && (svars->state[F] & ST_DID_EXPUNGE)) && (srec->status & S_DEL(N))) {
PC_JLOG( "< %u %u 0", (srec->uid[F], srec->uid[N]), "orphaning" ); PC_JLOG( "< %u %u 0", (srec->uid[F], srec->uid[N]), "orphaning" );
srec->uid[F] = 0; srec->uid[F] = 0;
} }

Loading…
Cancel
Save