You are not logged in.

#1 2015-04-03 17:23:47

SwitchDhole
Member
Registered: 2015-02-01
Posts: 51

OfflineIMAP: Infinite Folder Creation Detected

Hello Arch Forums!

I'm configuring OfflineIMAP 6.5.6-1 with Gmail.

I've added the gmail portion from the OfflineIMAP wiki page to my .offlineimaprc, and added in my own info.
The wiki page says I also have to add the nametrans rule to my local repository:

you may need a nametrans rule for your local repository too that reverses the effects of this nametrans rule

To do so I just copied the one from my remote repository to my local repository, no changes:

[general]
accounts = gmail@gmail.com
maxsyncaccounts = 1

[Account gmail@gmail.com]
localrepository = gmail@gmail.com-local
remoterepository = gmail@gmail.com-remote
status_backend = sqlite
autorefresh = 5
quick = 10

[Repository gmail@gmail.com-local]
type = Maildir
localfolders = ~/mail/gmail@gmail.com
nametrans = lambda foldername: re.sub ('^\[gmail\]', 'bak',
                               re.sub ('sent_mail', 'sent',
                               re.sub ('starred', 'flagged',
                               re.sub (' ', '_', foldername.lower()))))

[Repository gmail@gmail.com-remote]
type = Gmail
remoteuser = gmail@gmail.com
remotepass = qwerty
nametrans = lambda foldername: re.sub ('^\[gmail\]', 'bak',
                               re.sub ('sent_mail', 'sent',
                               re.sub ('starred', 'flagged',
                               re.sub (' ', '_', foldername.lower()))))
folderfilter = lambda foldername: foldername not in '[Gmail]/All Mail'
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
keepalive = 60
holdconnectionopen = yes

[mbnames]
enabled = yes
filename = ~/.mutt/mailboxes
header = "mailboxes "
peritem = "+%(accountname)s/%(foldername)s"
sep = " "
footer = "\n"

However, the wiki page says I need one that counteracts the other nametrans rule, and I don't know if this does it.
Now when I start OfflineIMAP I get:

OfflineIMAP 6.5.5
  Licensed under the GNU GPL v2+ (v2 or any later version)
Account sync gmail@gmail.com:
 *** Processing account gmail@gmail.com
 Establishing connection to imap.gmail.com:993
 ERROR: INFINITE FOLDER CREATION DETECTED! Folder '[Gmail].All Mail' (repository 'gmail@gmail.com-local') would be created as folder 'bak/all_mail' (repository 'gmail@gmail.com-remote'). The latter becomes 'bak.all_mail' in return, leading to infinite folder creation cycles.
 SOLUTION: 1) Do set your nametrans rules on both repositories so they lead to identical names if applied back and forth. 2) Use folderfilter settings on a repository to prevent some folders from being created on the other side.
 *** Finished account 'gmail@gmail.com' in 0:07
 Next refresh in 5.0 minutes

Is there anything esle I should do to the local nametrans rule?

Offline

#2 2015-04-03 18:49:20

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: OfflineIMAP: Infinite Folder Creation Detected

You have to reverse the order of the translation:

In the remote folder block,

lambda foldername: re.sub ('^\[gmail\]', 'bak', ....

would be something like

lambda foldername: re.sub ('bak', '^\[gmail\]', 

in the local folder block.

Mine looks like:

[Repository mail_local]
...
nametrans = lambda folder: re.sub('spam', '[Gmail].Spam',
                           re.sub('drafts', '[Gmail].Drafts',
                           re.sub('sent', '[Gmail].Sent Mail',
                           re.sub('flagged', '[Gmail].Starred',
                           re.sub('trash', '[Gmail].Trash',
                           re.sub('archive', '[Gmail].All Mail', folder))))))
....
[Repository mail_remote]
...
nametrans = lambda folder: re.sub('.*Spam$', 'spam', 
                           re.sub('.*Drafts$', 'drafts', 
                           re.sub('.*Sent Mail$', 'sent', 
                           re.sub('.*Starred$', 'flagged', 
                           re.sub('.*Trash$', 'trash', 
                           re.sub('.*All Mail$', 'archive', folder))))))
....

Scott

Offline

#3 2015-04-04 18:15:30

SwitchDhole
Member
Registered: 2015-02-01
Posts: 51

Re: OfflineIMAP: Infinite Folder Creation Detected

I changed my local repository:

nametrans = lambda foldername: re.sub ('bak', '^\[gmail\]',
                               re.sub ('sent', 'sent_mail',
                               re.sub ('flagged', 'starred',
                               re.sub ('_', ' ',  foldername.lower()))))

Still, getting the same error sad

I also tried using your nametrans rules, which led me to:

OfflineIMAP 6.5.5
  Licensed under the GNU GPL v2+ (v2 or any later version)
Account sync gmail@gmail.com:
 *** Processing account gmail@gmail.com
 Establishing connection to imap.gmail.com:993
 ERROR: INFINITE FOLDER CREATION DETECTED! Folder 'bak.spam' (repository 'gmail@gmail.com-local') would be created as folder 'bak/[Gmail]/Spam' (repository 'gmail@gmail.com-remote'). The latter becomes 'spam' in return, leading to infinite folder creation cycles.
 SOLUTION: 1) Do set your nametrans rules on both repositories so they lead to identical names if applied back and forth. 2) Use folderfilter settings on a repository to prevent some folders from being created on the other side.
 *** Finished account 'gmail@gmail.com' in 0:04
 Next refresh in 5.0 minutes

Last edited by SwitchDhole (2015-04-04 18:18:38)

Offline

#4 2015-04-04 19:04:54

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: OfflineIMAP: Infinite Folder Creation Detected

If you have different folders than firecat53, you shouldn't be surprised that those rules don't work for you. And you can't simply exchange the first and second arguments to re.sub as firecat53 suggests: the first is a pattern, the second is just text*. The order of re.sub()s could also be important depending on the substitutions.

Maybe work it out on paper first, without any python regexps. If you want to use a nametrans in one direction, you need another to 'undo' those translations for the other direction. That means that some translations (such as str.lower()) might be problematic; just give it a little thought. Then a basic understanding of regular expressions also helps.

*: actually, you can also reference matched groups from the pattern.

Offline

#5 2015-04-05 10:02:21

SwitchDhole
Member
Registered: 2015-02-01
Posts: 51

Re: OfflineIMAP: Infinite Folder Creation Detected

Time to learn python.

Offline

Board footer

Powered by FluxBB