readonly settings - strange behavior

Tomasz Nowak nowak2000 at poczta.onet.pl
Wed Sep 14 22:14:52 BST 2011


Hi!
I'd like to share my doubts about "readonly" configuration with you.

My ~/.offlineimaprc is configured to synchronize mails bidirectionally (IMAP <-> Maildir) with "readonly = False". 

Despite this, I only manage to get messages from IMAP. I tried to debug this issue and introduced some modifications to the code (base version: commit e5a26dcfd8a2631f8fcbe8e0c32abed85fc7cd84, Merge: 0c0d0c0 1a4b7c3, Author: Nicolas Sebrecht <nicolas.s-dev at laposte.net>, Date:   Mon Sep 12 20:13:08 2011 +0200):

diff --git a/offlineimap/CustomConfig.py b/offlineimap/CustomConfig.py
index 42132f8..47c4f81 100644
--- a/offlineimap/CustomConfig.py
+++ b/offlineimap/CustomConfig.py
@@ -96,13 +96,15 @@ class ConfigHelperMixin:
             return apply(defaultfunc, [self.getsection(), option, default])
 
 
     def getconf(self, option,
                 default = CustomConfigDefault):
-        return self._confighelper_runner(option, default,
+        result = self._confighelper_runner(option, default,
                                          self.getconfig().getdefault,
                                          self.getconfig().get)
+        print "= = = = %s.getconf(%s, %s) = %s" % (self, option, default, result)
+        return result
 
     def getconfboolean(self, option, default = CustomConfigDefault):
         return self._confighelper_runner(option, default,
                                          self.getconfig().getdefaultboolean,
                                          self.getconfig().getboolean)
diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py
index 31ea2b7..b24ffcc 100644
--- a/offlineimap/accounts.py
+++ b/offlineimap/accounts.py
@@ -347,19 +347,19 @@ def syncfolder(accountname, remoterepos, remotefolder, localrepos,
         # Synchronize remote changes.
         if not localrepos.getconf('readonly', False):
             ui.syncingmessages(remoterepos, remotefolder, localrepos, localfolder)
             remotefolder.syncmessagesto(localfolder, statusfolder)
         else:
-            ui.debug('imap', "Not syncing to read-only repository '%s'" \
+            ui.debug('imap', "Not syncing to read-only local repository '%s'" \
                          % localrepos.getname())
         
         # Synchronize local changes
         if not remoterepos.getconf('readonly', False):
             ui.syncingmessages(localrepos, localfolder, remoterepos, remotefolder)
             localfolder.syncmessagesto(remotefolder, statusfolder)
         else:
-            ui.debug('', "Not syncing to read-only repository '%s'" \
+            ui.debug('', "Not syncing to read-only remote repository '%s'" \
                          % remoterepos.getname())
 
         statusfolder.save()
         localrepos.restore_atime()
     except (KeyboardInterrupt, SystemExit):
---------------

Now that I see what values are read for the 'readonly' options I try to synchronize the account.

$ python ./offlineimap.py -d all  -1 | grep -i readonly -C 10
= = = = RemoteExample.getconf(idlefolders, []) = []
= = = = RemoteExample.getconf(folderfilter, <function CustomConfigDefault at 0xb706b994>) = lambda foldername: re.search('mail', foldername)
= = = = RemoteExample.getconf(folderincludes, <function CustomConfigDefault at 0xb706b994>) = ['INBOX']
= = = = MAN.getconf(localrepository, <function CustomConfigDefault at 0xb706b994>) = LocalExample
= = = = LocalExample.getconf(localfolders, <function CustomConfigDefault at 0xb706b994>) = ~/Mail
= = = = LocalExample.getconf(sep, .) = /
DEBUG[maildir]: MaildirRepository initialized, sep is '/'
= = = = MAN.getconf(localrepository, <function CustomConfigDefault at 0xb706b994>) = LocalExample
= = = = MAN.getconf(status_backend, plain) = sqlite
= = = = MAN.getconf(presynchook, ) = 
= = = = LocalExample.getconf(readonly, False) = False
Copying folder structure from IMAP to Maildir
Establishing connection to my_server:993.
= = = = RemoteExample.getconf(cert_fingerprint, None) = None
DEBUG[imap]:   20:49.19 Account sync MAN imaplib2 version 2.28
DEBUG[imap]:   20:49.19 Account sync MAN imaplib2 debug level 5, buffer level 3
DEBUG[imap]:   21:20.49 my_server writer starting
DEBUG[imap]:   21:20.49 my_server reader starting using poll
DEBUG[imap]:   21:20.49 Account sync MAN _request_push(continuation, None, {}) = LFJL0
DEBUG[imap]:   21:20.49 Account sync MAN None:LFJL0.ready.wait
DEBUG[imap]:   21:20.53 my_server reader poll => [(9, 1)]
--
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen \\Deleted)', 'UID': '5752071'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen)', 'UID': '5752072'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen \\Deleted)', 'UID': '5752073'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen \\Deleted)', 'UID': '5752074'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen \\Deleted)', 'UID': '5752075'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen \\Answered)', 'UID': '5752076'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen)', 'UID': '5752077'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen)', 'UID': '5752078'}
DEBUG[imap]: options2hash returning: {'FLAGS': '(\\Seen \\Deleted)', 'UID': '5752079'}
DEBUG[imap]: options2hash returning: {'FLAGS': '()', 'UID': '5752080'}
= = = = LocalExample.getconf(readonly, False) = False
= = = = RemoteExample.getconf(readonly, False) = False
DEBUG[]: Not syncing to read-only remote repository 'RemoteExample'
DEBUG[thread]: Register new thread 'Folder sync [MAN]' (account 'MAN')
= = = = LocalExample.getconf(sep, .) = /
= = = = LocalExample.getconf(sep, .) = /
Syncing mail/big_letters: IMAP -> Maildir
DEBUG[imap]:   21:40.43 Folder sync [MAN] [sync] SELECT ('mail/big_letters',)
DEBUG[imap]:   21:40.43 Folder sync [MAN] state_change_pending.acquire
DEBUG[imap]:   21:40.43 Folder sync [MAN] _request_push(LFJL9, SELECT, {}) = LFJL9
DEBUG[imap]:   21:40.43 Folder sync [MAN] data=LFJL9 SELECT mail/big_letters
DEBUG[imap]:   21:40.43 Folder sync [MAN] SELECT:LFJL9.ready.wait


The second chunk shows that neither of the repositories is readonly, but still offlineimap decides not to synchronize them. 

How can that be?


My configuration:
$ grep -i 'readonly\|^\[' ~/.offlineimaprc | grep -v '^#'
[general]
ignore-readonly = yes
[mbnames]
[ui.Curses.Blinkenlights]
[Account MAN]
readonly = False
[Repository LocalExample]
[Repository RemoteExample]
readonly = False

Even if I placed unnecessary 'readonly = False' in the [Account MAN] section, it should not interfere with the settings of the repositories.

Best regards,
Tomasz 




More information about the OfflineIMAP-project mailing list