commit 6fe7172901ec434802aa12258ed5b0857c9aa34d
parent edbf9a35daf954ad1a032e1030269f8119b0fa78
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Thu, 21 Apr 2022 16:14:27 +0200
moan about trashing in non-UIDPLUS boxes
... as that's inherently racy, as the manual says.
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/driver.h b/src/driver.h
@@ -107,7 +107,8 @@ BIT_ENUM(
#define STORE(store) \
store *next; \
driver_t *driver; \
- store##_conf *conf; /* foreign */
+ store##_conf *conf; /* foreign */ \
+ uchar racy_trash;
typedef struct store {
STORE(struct store)
diff --git a/src/sync.c b/src/sync.c
@@ -813,8 +813,16 @@ box_opened2( sync_vars_t *svars, int t )
else if (chan->ops[N] & (OP_OLD | OP_NEW | OP_UPGRADE))
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] );
+ for (t = 0; t < 2; t++) {
+ svars->opts[t] = svars->drv[t]->prepare_load_box( ctx[t], opts[t] );
+ if (opts[t] & ~svars->opts[t] & OPEN_UID_EXPUNGE) {
+ if (!ctx[t]->racy_trash) {
+ ctx[t]->racy_trash = 1;
+ notice( "Notice: Trashing in Store %s is prone to race conditions.\n",
+ svars->chan->stores[t]->name );
+ }
+ }
+ }
ARRAY_INIT( &mexcs );
if ((svars->opts[F] & OPEN_PAIRED) && !(svars->opts[F] & OPEN_OLD) && chan->max_messages) {