[Bug 289428] New: changing message flags (in KMail2) can lose message permanently

Jonathan Marten jjm at keelhaul.me.uk
Tue Dec 20 13:36:36 GMT 2011


https://bugs.kde.org/show_bug.cgi?id=289428

           Summary: changing message flags (in KMail2) can lose message
                    permanently
           Product: Akonadi
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: NOR
         Component: Maildir Resource
        AssignedTo: kdepim-bugs at kde.org
        ReportedBy: jjm at keelhaul.me.uk


Version:           unspecified (using Devel) 
OS:                Linux

Changing some message flags in KMail (e.g. "Important", "Action Item")
sometimes causes the message to disappear and be permanently lost.


Reproducible: Sometimes

Steps to Reproduce:
In KMail2, select a message which is in a Maildir folder.
Do "Menu bar - Message - Mark Message - Mark Mail as Important"
or "Menu bar - Message - Mark Message - Mark Mail as Action Item"
a few times to turn the flags on or off.

Actual Results:  
The email sometimes disappears.  It cannot be found in the trash folder or
anywhere else.


Expected Results:  
The message flags are just changed as requested.


A message appears in the debug log when this happens:

Maildir: Failed to add entry: 
"/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S"
! Error:  "Unknown error"                                        
kmail2(19249) KMKernel::instanceError:  instance : "akonadi_maildir_resource_4"
 received error : "Failed to change the flags for the mail."                    

The problem may be in Maildir::changeEntryFlags() in
kdepimruntime/resources/maildir/libmaildir/maildir.cpp.  I have not yet
examined this in detail, but a strace of the akonadi_maildir_resource process
shows the following system calls:

open("/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S",
O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 14
open("/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S",
O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 14
unlink("/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S")
= 0
lstat64("/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S",
0xbf9e04a8) = -1 ENOENT (No such file or directory)
rename("/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S",
"/home/jjm/Mail.kmail2/.LocalFolders.directory/wastebin/cur/1324056139.R363.hostname:2,S")
= -1 ENOENT (No such file or directory)

This sequence of calls is consistent with realKey being equal to finalKey just
before the

    QFile f( realKey );
    if (QFile::exists(finalKey)) {
        QFile destFile(finalKey);

sequence in this function.

The result is that the original message file is removed and the message
disappears.

This may be a consequence of commit 8e09b79d1dd388ed9ad966638c29c483be6eb90a.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list