diff --git a/src/run-tests.pl b/src/run-tests.pl index 72c8133..00959c1 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -605,10 +605,14 @@ sub cmptrash($$$) print STDERR "Missing message $bn:".mn($num)."\n"; $ret = 1; } + if ($ph) { + print STDERR "Message $bn:".mn($num)." is placeholder\n"; + $ret = 1; + } } for my $num (sort { $a <=> $b } keys %$ms) { if (!defined($$ref_ms{$num})) { - print STDERR "Excess message $bn:".mn($num)."\n"; + print STDERR "Excess message $bn:".mn($num).($$ms{$num} ? " (is placeholder)" : "")."\n"; $ret = 1; } } @@ -1057,7 +1061,7 @@ my @X22 = ( B, "", ">->", "^*", B, "", "", "&1/", C, "^F*", "<-<+F", "", - C, "&1+T", "^T", "&", + C, "&1+T", "^", "&", ); test("max size + flagging", \@x22, \@X22, \@O21); @@ -1145,12 +1149,16 @@ test("max messages + expunge", \@x38, \@X38, \@O38); # Trashing my @x10 = ( - E, A, E, + K, A, K, A, "*", "*~", "*T", B, "*T", "*^", "", C, "*T", "*", "*T", D, "_", "*", "*", E, "*", "*", "_", + F, "**", "*>", "*T?", + G, "*T?", "*<", "**", + J, "**", "*>", "*F?", + K, "*F?", "*<", "**", L, "*T", "", "", M, "", "", "*T", R, "", "", "*", # Force maxuid in the interrupt-resume test. @@ -1166,6 +1174,12 @@ my @X11 = ( C, "#/", "/", "#/", D, "", "/", "#/", E, "#/", "/", "", + F, "#/", "/", "/", + G, "/", "/", "#/", + J, "", ">->", "^*", + J, "", "", "&1/", + K, "^*", "<-<", "", + K, "&1/", "", "", L, "#/", "", "", M, "", "", "#/", R, "*", "*", "", @@ -1182,6 +1196,12 @@ my @X12 = ( C, "#/", "/", "/", D, "", "/", "/", E, "#/", "/", "", + F, "#/", "/", "/", + G, "/", "/", "#/", + J, "", ">->", "^*", + J, "", "", "&1/", + K, "^*", "<-<", "", + K, "&1/", "", "", L, "#/", "", "", M, "", "", "#/", R, "*", "*", "", @@ -1198,6 +1218,12 @@ my @X13 = ( C, "#/", "/", "/", D, "", "/", "/", E, "#/", "/", "", + F, "#/", "/", "/", + G, "#/", "/", "/", + J, "", ">->", "^*", + J, "", "", "&1/", + K, "^*", "<-<", "", + K, "&1/", "", "", L, "#/", "", "", M, "#", "", "/", R, "*", "*", "", diff --git a/src/sync.c b/src/sync.c index ee3af7e..62c48a6 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1498,7 +1498,10 @@ flags_set( int sts, void *aux ) static void flags_set_p2( sync_vars_t *svars, sync_rec_t *srec, int t ) { - if (srec->status & S_DELETE) { + if (srec->status & S_PURGE) { + JLOG( "P %u %u", (srec->uid[F], srec->uid[N]), "deleted dummy" ); + srec->status = (srec->status & ~S_PURGE) | S_PURGED; + } else if (srec->status & S_DELETE) { JLOG( "%c %u %u 0", ("><"[t], srec->uid[F], srec->uid[N]), "%sed deletion", str_hl[t] ); srec->uid[t^1] = 0; } else { @@ -1570,6 +1573,17 @@ msgs_flags_set( sync_vars_t *svars, int t ) debug( "is expired\n" ); continue; } + if (srec->status & S_DUMMY(t)) { + // This is mostly academical, as trashing being done on the side + // where placeholders reside is rather unlikely. + debug( "is dummy\n" ); + continue; + } + if (srec->status & S_PURGED) { + // As above. + debug( "is deleted dummy\n" ); + continue; + } if (only_new && !(srec->status & (S_PENDING | S_DUMMY(t^1) | S_SKIPPED))) { debug( "is not new\n" ); continue; diff --git a/src/sync_p.h b/src/sync_p.h index 529a010..704c10c 100644 --- a/src/sync_p.h +++ b/src/sync_p.h @@ -21,6 +21,7 @@ BIT_ENUM( S_DELETE, // ephemeral: flags propagation is a deletion S_UPGRADE, // ephemeral: upgrading placeholder, do not apply MaxSize S_PURGE, // ephemeral: placeholder is being nuked + S_PURGED, // ephemeral: placeholder was nuked ) // This is the persistent status of the sync record, with regard to the journal. diff --git a/src/sync_state.c b/src/sync_state.c index 42a9a19..3f72177 100644 --- a/src/sync_state.c +++ b/src/sync_state.c @@ -292,6 +292,7 @@ load_state( sync_vars_t *svars ) case 'N': case 'F': case 'T': + case 'P': case '+': case '&': case '-': @@ -378,8 +379,11 @@ load_state( sync_vars_t *svars ) case '*': debug( "flags now %u\n", t3 ); srec->flags = (uchar)t3; - srec->aflags[F] = srec->aflags[N] = 0; // Clear F_DELETED from purge - srec->status &= ~S_PURGE; + break; + case 'P': + debug( "deleted dummy\n" ); + srec->aflags[F] = srec->aflags[N] = 0; // Clear F_DELETED + srec->status = (srec->status & ~S_PURGE) | S_PURGED; break; case '~': srec->status = (srec->status & ~S_LOGGED) | t3;