Getting offlineimap to maintain a specific maildir structure

Rogério Brito rbrito at
Sun Aug 26 00:37:17 BST 2012

Hi, Sebastian.

First of all, thank you very much for the reply. You don't really believe
how it is apreciated by me.

I was already holding (in Debian-speak) the offlineimap package at version
6.3.4 on all of my machines.

On Aug 25 2012, Sebastian Spaeth wrote:
> Rogério Brito <rbrito at> writes:
> > What I do is: I map gmail's INBOX to the toplevel maildir and, then, all 
> > the other folders get put inside this maildir, with the names prefixed by 
> > a dot and with the separator being a dot.
> > | nametrans		= lambda name: re.sub('^', '.', re.sub('^(\[Gmail
> > \]/|INBOX)', '', name))
> > From what I understand, I disabled the bidirectional syncing with 
> > createfolders=false (in an attempt to mimic as much as possible the 
> > behavior of 6.3.4), but I get the following error message:
> > | Creating folder .[local]
> > | ERROR: Aborting sync, folder '.' [acc: 'email']
> > |   getfolder() asked for a nonexisting folder '.'.
> Mmmh, this has nothing to do with nametrans or folder creation, I
> think. It has something to do with how OfflineImap treats the very
> top-level folder and there is a bug somewhere.

Yes, I guessed that, but not really sure of what is/was going on.

Just so you know my intention, my goal is to create in my local maildir a
folder structure in a way that I have traditionally used with imap servers
like courier and dovecote.

Basically, the only point remaining is the conversion of gmail's INBOX to
the top level folder, which should be the main maildir.

> You have configured your nametrans rule, so that the GMAIL "INBOX"
> effective becomes folder ".".

Yes, precisely.

> When we walk the local maildir folders checking if folder "." exists, we
> don't find a folder "." and try to create folder "." which fails.

I'm not really sure. Tried to read the code, but gave up with some other

> I will have to check how we deal with this, I believe there were some
> changes that might have caused this.

If you want, I git bisected to see which commit introduced the change where
things broke:

,----[ git bisect log ]
| git bisect start
| # good: [61e50b3b1a81a564697a74384f528b22dfd32d8b] v6.3.4
| git bisect good 61e50b3b1a81a564697a74384f528b22dfd32d8b
| # bad: [010941e12e9caaacf312cdb1a8149a1ec2c3e5a6] Merge branch 'next'
| git bisect bad 010941e12e9caaacf312cdb1a8149a1ec2c3e5a6
| # bad: [6f361c4d9a25f092fc2dc81b68bdba03c8b4ca67] Don't output "Finished in x seconds" in quiet ui
| git bisect bad 6f361c4d9a25f092fc2dc81b68bdba03c8b4ca67
| # good: [ee75e0921ff105d19f619973dba188fc6900ff45] Remove 'config' as parameter from BaseFolder & derivatives
| git bisect good ee75e0921ff105d19f619973dba188fc6900ff45
| # bad: [93b05215fba364564018c52ab257a323c25277d4] Condense ui.connecting() function a bit
| git bisect bad 93b05215fba364564018c52ab257a323c25277d4
| # skip: [eeef8f4bab057e1e73ab7d1d17898643dee003aa] Don't ask for hostname if using a tunnel
| git bisect skip eeef8f4bab057e1e73ab7d1d17898643dee003aa
| # skip: [48fdb1441892e1fdade1e13cd5679755bee53a81] Don't output thread ID in log
| git bisect skip 48fdb1441892e1fdade1e13cd5679755bee53a81
| # bad: [953c58a9c917f467d7256945e207e72f59227a13] Robustify (&fix) error throwing on APPEND
| git bisect bad 953c58a9c917f467d7256945e207e72f59227a13
| # bad: [3157a8d793876d050bff29a3830c26a43ed8a78a] repository.Gmail.getfolder()
| git bisect bad 3157a8d793876d050bff29a3830c26a43ed8a78a
| # good: [19ff636390a06fd6c82f6087cb1647e00d34856c] Properly output errors when the main thread receives some
| git bisect good 19ff636390a06fd6c82f6087cb1647e00d34856c
| # good: [32ca20d0da97b2ed2b377c06f12f4365af37538c] Folder.Maildir: No need to store 'uid' in messagelist dict.
| git bisect good 32ca20d0da97b2ed2b377c06f12f4365af37538c
| # good: [792243c78f6138904863f60059db051a6c4e4934] Improve repository/Maildir.getfolder() to use cached objects
| git bisect good 792243c78f6138904863f60059db051a6c4e4934
| # bad: [a279aa7307ca036f93b660ade84099550ff1a4f2] Maildir: Call top-level directory '', not '.'
| git bisect bad a279aa7307ca036f93b660ade84099550ff1a4f2

Which leads me to:

,----[ git bisect bad ]
| a279aa7307ca036f93b660ade84099550ff1a4f2 is the first bad commit
| commit a279aa7307ca036f93b660ade84099550ff1a4f2
| Author: Sebastian Spaeth <Sebastian at>
| Date:   Mon Sep 19 14:14:44 2011 +0200
|     Maildir: Call top-level directory '', not '.'
|     If nametrans translates to an empty directory we want to find the
|     top-level directory by name '' and not by name '.'. This unbreaks
|     nametrans rules that result in empty folder names.
|     Signed-off-by: Sebastian Spaeth <Sebastian at>
| :040000 040000 9f22f1d8516efbd5776b008ae2f560af746a88f4 e0f61c67e11efbf034ebe29e89c7c17b6615099f M	offlineimap

Given what is above, I tried both to change the nametrans to map INBOX to
the simple dot or to the empty string. Neither worked.

> Thanks for the reminder to look into this.

Thanks for your work maintaining offlineimap.

Rogério Brito : rbrito@{,} : GPG key 4096R/BCFCAAAA : Projects :

More information about the OfflineIMAP-project mailing list