hello *,

from time to time, mbsync will throw a "duplicate UID" error for no
reason whatsoever. i tracked this down to readdir() apparently returning
the same entries multiple times, even for directories which were not
touched for months. i suspect a kernel bug, but maybe i'm just missing
some invalid assumption in my code. anyone has an idea?
>From b4d7e0d63dd83850f1db97082a1b12a2c5fb82ad Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <[email protected]>
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
-- 
1.8.4.3

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to