From f1f6d33bad01fc198f50da6f8dbb099c09e2930b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 3 Aug 2013 09:36:31 +0200 Subject: [PATCH] *** work around readdir() sometimes returning the same entries multiple times this appears to ever happen only on my ReiserFS partition at home. it's not reproducible with "ls -U", mc, or any attempt at looping mbsync - it happens from time to time when mbsync runs in the background during regular operation. --- src/drv_maildir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/drv_maildir.c b/src/drv_maildir.c index b62848e..1eb50f5 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -764,6 +764,11 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist ) qsort( msglist->ents, msglist->nents, sizeof(msg_t), maildir_compare ); for (uid = i = 0; i < msglist->nents; i++) { entry = &msglist->ents[i]; + /* ReiserFS bogosity hack. */ + if (i && !strcmp( entry->base, msglist->ents[i-1].base )) { + warn( "Maildir warning: duplicate directory entries. Retrying ...\n" ); + goto retry; + } if (entry->uid != INT_MAX) { if (uid == entry->uid) { #if 1