Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot handle 'already exists' and 'Cannot create this folder' messages when syncing folders with Courier IMAP #188

Open
RigacciOrg opened this issue Mar 21, 2024 · 1 comment
Labels
question Further information is requested

Comments

@RigacciOrg
Copy link

General informations

  • system/distribution (with version): Debian GNU/Linux 12.4
  • offlineimap version (offlineimap -V): offlineimap v8.0.0, imaplib2 v3.05, Python v3.11.2, OpenSSL 3.0.11 19 Sep 2023
  • Python version: 3.11.2
  • CLI options:
  • Courier IMAP: 5.0.13

Configuration file offlineimaprc

[general]
accounts = CopyFromIMAP

[Account CopyFromIMAP]
remoterepository = OldServer
localrepository = Ipbox

[Repository OldServer]
type = IMAP
nametrans = lambda foldername: re.sub(r'^INBOX\/$', 'INBOX', 'INBOX/' + re.sub(r'(^INBOX$)|(^INBOX\.)', '', foldername))
remotehost = RemoteHost
remoteuser = RemoteUser
remotepass = MySecret
createfolders = False
sslcacertfile = /usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt

[Repository Ipbox]
type = IMAP
remotehost = 127.0.0.1
remoteuser = LocalUser
remotepass = MySecret
sslcacertfile = /usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt

pythonfile (if any)

Logs, error

Without the patch OfflineIMAP/offlineimap@5943e13 the error rises when syncing the first subdirectory (e.g. INBOX.Archive):

 Creating folder INBOX[Ipbox]
 ERROR: Creating folder INBOX.Archive on repository Ipbox
  Folder 'INBOX'[Ipbox] could not be created. Server responded: ('NO', [b'INBOX already exists!'])
 ERROR: Folder 'INBOX'[Ipbox] could not be created. Server responded: ('NO', [b'INBOX already exists!'])

After applying the patch OfflineIMAP/offlineimap@5943e13 the error rises at the second level subdirectory (e.g. INBOX.Archive.2013):

 Creating folder INBOX[Ipbox]
 Creating folder INBOX.Archives[Ipbox]
 ERROR: Creating folder INBOX.Archives.2013 on repository Ipbox
  Folder 'INBOX.Archives'[Ipbox] could not be created. Server responded: ('NO', [b'Cannot create this folder.'])
 ERROR: Folder 'INBOX.Archives'[Ipbox] could not be created. Server responded: ('NO', [b'Cannot create this folder.'])

Steps to reproduce the error

  • Configure offlineimap3 to syncronize between two IMAP accounts.
  • The receiving IMAP account is hadled by the Courier IMAP server 5.0.13.
  • In the source IMAP account has a subfolder and a sub-subfolder.
  • Run offlineimap to syncronize source with destination.
  • The program crashe at the first subfolder, e.g. INBOX.Archive.
  • Apply the patch 5943e13737ebf1086a1adff6f8d2299324110d0a and re-run offlineimap.
  • The program crashe at the first subfolder, e.g. INBOX.Archive.2013.

As you can see in the following IMAP session, the Courier IMAP server responds with different messages when creating an already existing subfolder, depending on the subfolder depth:

AAA1 LIST "" "*"
* LIST (\HasNoChildren) "." "INBOX.Archives.2013"
* LIST (\HasNoChildren) "." "INBOX.Sent"
* LIST (\HasChildren) "." "INBOX.Archives"
* LIST (\HasNoChildren) "." "INBOX.Trash"
* LIST (\HasNoChildren) "." "INBOX.Archive"
* LIST (\Unmarked \HasChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "INBOX.Drafts"
* LIST (\HasNoChildren) "." "INBOX.Spam"
AAA1 OK LIST completed
AAA2 CREATE INBOX
AAA2 NO INBOX already exists!
AAA3 CREATE INBOX.Archives
AAA3 NO Cannot create this folder.
AAA4 CREATE INBOX.Archives.2024
AAA4 OK "INBOX.Archives.2024" created.
AAA5 CREATE INBOX.Archives.2024
AAA5 NO Cannot create this folder.

The problem is that offlineimap is programmed to only ignore errors containing the string [ALREADYEXISTS]. Errors containing the already exists! and Cannot create this folder strings are instead raised.

The the already exists! problem is the same reported by issue #130.

@thekix thekix added the question Further information is requested label Aug 15, 2024
@thekix
Copy link
Member

thekix commented Aug 15, 2024

Hi,

I applied the patch "Merge pull request #178 from roboshim/dont-create-existing-folder". This patch solves this problem?

Regards,
kix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants