Resynchronising most folders?

P.H. qikom at free.fr
Wed Nov 20 10:09:29 GMT 2013


Hi...

I've been using offlineimap happily for several years and decided to 
try to upgrade to a newer version. (I currently use 6.3.4...)

First, what's the current consensus as far as stability is concerned?
I've never had any problem in the 5 years I've been using offlineimap, 
and would very much like to keep it that way.


Anyway, I got the latest version (6.5.5), tried to convert my config 
file (to use sqlite and allow creation of imap mailboxes), and used the 
--dry-run option.

It seems most of my mailboxes need to be resynchronised:

$ offlineimap -c offlineimap.conf.new --dry-run
OfflineIMAP 6.5.5
   Licensed under the GNU GPL v2+ (v2 or any later version)
...
...
Folder INBOX/Remind [acc: Com]:
  Syncing INBOX/Remind: IMAP -> Maildir
  [DRYRUN] Copy 32 messages from Remind[LocalCom] to RemoteCom
  [DRYRUN] Deleting 32 messages (19429:19460) in IMAP[INBOX/Remind]
...


I did run without --dry-run on a single mailbox, after appropriate backup, and
the messages are indeed uploaded / downloaded, with new UIDs.
Reverting back to version 6.3.4 ended up resynchronising the mailbox again!


Apparently, the problem comes the reverse nametrans option.

I put

  nametrans = forward_nametrans
  createfolders = True

in the remote and

  nametrans = reverse_nametrans

in the local.

The function forward_nametrans and reverse_nametrans are defined in 
~/.offlineimap.py as 

def forward_nametrans(imap_folder):
    return re.sub('^INBOX/', '', imap_folder)

def reverse_nametrans(local_folder):
    if local_folder in ['INBOX', 'Chats', 'Contacts', 'Drafts',
                        'Emailed Contacts', 'Junk', 'Sent', 'Trash']:
        return local_folder
    else:
        return 'INBOX/' + local_folder

After removing the nametrans option in the local (and putting the create_folder
to False to avoid infinite folder creation), synchronizing worked as expected
(no synchronisation necessary).


Note that the --info flag gave the expected thing:
Remote repository ...
Folderlist:
 ...
 INBOX/Remind -> Remind
 ...
Local repository ...
Folderlist:
 ...
 Remind -> INBOX/Remind
 ...


So, my questions are:

Does anyone have an idea about what's happening?
(If needs be, I can run more tests...)

Does anyone have an idea about what to do to avoid resynchronising everything
and still keep the create_folder option? (I have several accounts with quite a
few messages. I can live with starting from scratch, but would prefer to avoid
it...)



Thanks a lot!


Pierre


PS: I'm pretty sure the following is a typo in the documentation (in
nametrans.rst)

"""
Take the above examples. If your remote nametrans setting was::

     nametrans = lambda folder: re.sub('^INBOX\.', '', folder)

  then you will want to have this in your local repository, prepending "INBOX" to any local folder name::

     nametrans = lambda folder: 'INBOX' + folder
"""
The last line should be
     nametrans = lambda folder: 'INBOX.' + folder

-- 
It is not easy, and perhaps not even useful, to explain
briefly what logic is.
     -- E. J. Lemmon



More information about the OfflineIMAP-project mailing list