[Users] [Bug 3601] New: Mail lost when moving folder in IMAP

noreply at thewildbeast.co.uk noreply at thewildbeast.co.uk
Sat Jan 23 14:10:27 CET 2016


            Bug ID: 3601
           Summary: Mail lost when moving folder in IMAP
    Classification: Unclassified
           Product: Claws Mail
           Version: GIT
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P3
         Component: Folders/IMAP
          Assignee: users at lists.claws-mail.org
          Reporter: kae at midnighthax.com

IMAP server: Dovecot 2.2.13

When moving a folder containing mail to another location within the folder
tree, the destination folder is created but the contents of the source folder
are not copied; the source folder and contents are deleted. The result is an
empty destination folder.

It may be that Dovecot is, in some way, contributing to this. I've posted the
IMAP log below (I've changed the name of the IMAP server in the logs, but
otherwise unedited). A few observations:

- Dovecot reports that the destination folder is created, yet reports it
doesn't exist when Claws tries to SUBSCRIBE to it. This may be some kind of
race condition; when the entire operation is complete, the destination folder
*does* exist.

- There is an error when Claws SUBSCRIBEs to the destination folder, but Claws
doesn't check for errors at that point.

- After Claws issues the COPY, Dovecot reports NO. I believe, at this point,
Claws should abort the move. Even if the original bug is within Dovecot (and
that's not clear), once Claws is told that the COPY has failed, it should not
go on to delete the source mails and folder.

I can reliably reproduce this. The situation may be made more complex by the
fact that the destination folder is a "public" folder within Dovecot; however,
the key issue above is that Claws continues with the deletion of the source
mails and folder despite being told that the copy has failed.

A first pass of the code suggests that this may be an Etpan bug, possibly
within threaded_run().

I'm happy to do more research or test potential fixes.

IMAP log, moving folder 'test' to 'public/accounts':

* Account 'TCL': Connecting to IMAP4 server: imap.example.com:993...
* IMAP connection is un-authenticated
[12:37:08] IMAP4> 1 CAPABILITY 
[12:37:08] IMAP4< 1 OK Pre-login capabilities listed, post-login capabilities
have more. 
[12:37:08] IMAP4> Logging kae to imap.example.com using LOGIN
[12:37:08] IMAP4< Logged in
[12:37:08] IMAP4< Login to imap.example.com successful
[12:37:08] IMAP4> 3 LIST "" "" 
[12:37:08] IMAP4< * LIST (\Noselect) "/" "" 
[12:37:08] IMAP4< 3 OK List completed. 
[12:37:08] IMAP4> 4 LIST "" "public/accounts/test" 
[12:37:08] IMAP4< 4 OK List completed. 
[12:37:08] IMAP4> 5 CREATE "public/accounts/test" 
[12:37:08] IMAP4< 5 OK Create completed. 
[12:37:08] IMAP4> 6 LIST "" "public/accounts/test" 
[12:37:08] IMAP4< 6 OK List completed. 
[12:37:08] IMAP4> 7 SUBSCRIBE "public/accounts/test" 
[12:37:08] IMAP4< 7 NO Mailbox doesn't exist: public/accounts/test 
* Moving test to public/accounts/test...
[12:37:08] IMAP4> 8 SELECT test 
[12:37:08] IMAP4< * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 
[12:37:08] IMAP4< * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen
\Draft \*)] Flags permitted. 
[12:37:08] IMAP4< * 2 EXISTS 
[12:37:08] IMAP4< * 0 RECENT 
[12:37:08] IMAP4< * OK [UIDVALIDITY 1251379324] UIDs valid 
[12:37:08] IMAP4< * OK [UIDNEXT 3] Predicted next UID 
[12:37:08] IMAP4< 8 OK [READ-WRITE] Select completed (0.000 secs). 
[12:37:08] IMAP4> 9 UID COPY 1:2 "public/accounts/test" 
[12:37:08] IMAP4< 9 NO [TRYCREATE] Mailbox doesn't exist: public/accounts/test 
** IMAP error on imap.example.com: UID COPY error
[12:37:08] IMAP4> 10 UID STORE 1:2 +FLAGS.SILENT (\Deleted) 
[12:37:08] IMAP4< 10 OK Store completed. 
[12:37:08] IMAP4> 11 EXPUNGE 
[12:37:08] IMAP4< * 2 EXPUNGE 
[12:37:08] IMAP4< * 1 EXPUNGE 
[12:37:08] IMAP4< 11 OK Expunge completed. 
[12:37:08] IMAP4> 12 UNSUBSCRIBE test 
[12:37:08] IMAP4< 12 OK Unsubscribe completed.                                  
[12:37:08] IMAP4> 13 CLOSE                                                      
[12:37:08] IMAP4< 13 OK Close completed.                                        
[12:37:08] IMAP4> 14 DELETE test                                                
[12:37:09] IMAP4< 14 OK Delete completed.                                       
[12:37:09] IMAP4> 15 STATUS "public/accounts/test" (MESSAGES UIDNEXT
UIDVALIDITY UNSEEN)                                                             
[12:37:09] IMAP4< 15 NO Mailbox doesn't exist: public/accounts/test             
** IMAP error on imap.example.com: STATUS error

You are receiving this mail because:
You are the assignee for the bug.

More information about the Users mailing list