commit 6fe7172901ec434802aa12258ed5b0857c9aa34d
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Thu Apr 21 16:14:27 2022 +0200

    moan about trashing in non-UIDPLUS boxes
    
    ... as that's inherently racy, as the manual says.

 src/driver.h |  3 ++-
 src/sync.c   | 12 ++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index aea4fae8..55dd65bb 100644
--- 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
index 31d52652..ab076708 100644
--- 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) {


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to