Bug 332026

Summary: Kmail mixes up IMAP folders, causing huge data loss due to misplaced expiry dates
Product: [Applications] kmail2 Reporter: Gauss <third-impact>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: critical CC: kdenis, Stefan.Kelemen
Priority: NOR    
Version: 4.12.3   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Gauss 2014-03-11 12:43:31 UTC
Hello kmail team,
after using kmail till ~4.9 I switched to Thunderbird due to some annoying bugs. I wanted to give the new 4.12.3 version a chance, so I started up kmail and connected my IMAP account, because I had deleted the account from Akonadi when I switched to Thunderbird. Although I have deleted it, some of my settings were still present like filters, expiry dates etc. which shouldn't be a bad thing in the first place.

The problem is, that although none of the IMAP folder names have changed, kmail mixed up the folders, e.g. a filter which should move new mails like Logfiles to Administration/Logfiles it moved them to ProjectXY/ImportantStuff . The real problem is, that the same thing happened for the expiry dates. The folder Administration/Logfiles had an expiry date of 30 days, the folder ProjectXY/ImportantStuff had none. As the two folders were internally swapped all old mails in ProjectXY/ImportantStuff got deleted.
This did not just happen to two folders but kmail rampaged through my whole IMAP account. When I noticed it was already too late.

I haven't tried to reproduce this and will not try, but I suspect kmail is storing the info for the folders not by the folder name but maybe by some Akonadi ID (?),  and the ordering of those IDs was changed when I readded the account.
I think this is a highly critical and dangerous bug. While not appearing for everyday use it can cause tremendous data loss.

Reproducible: Didn't try

Actual Results:  
Filters move files to wrong directories, expiry dates are applied on the wrong directories causing data loss.

Expected Results:  
Either filters / expiry dates should be removed when the IMAP account is removed or a method should be implemented to ensure a correct association of the filters to the IMAP directories, once the account is readded (e.g. a simple identification by name would do the trick).
Comment 1 Denis Kurz 2016-09-24 18:05:49 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kmail2 (version 5.0 or later, as part of KDE Applications 15.12 or later), it gets closed in about three months.
Comment 2 Stefan Kelemen 2016-11-18 08:50:48 UTC
It sounds similar that bug

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

actual issue: rebuild mysql, account was not available for a little time, the filters are pointing on folders in an other imap account or the local folders.

So when a ressource or ressource part would changed, the automatic filters dont know what do with taht and change to invalid targets.

Quick hack:
Deactivate automatic filters. where i can do that?

Kontact 4.14.6
KMail 4.14.6
Plasma 5.8
Distibutor Neptune
Comment 3 Stefan Kelemen 2016-11-18 08:53:06 UTC
It sounds similar that bug

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

actual issue: rebuild mysql, account was not available for a little time, the filters are pointing on folders in an other imap account or the local folders.

So when a ressource or ressource part would changed, the automatic filters dont know what do with taht and change to invalid targets.

Quick hack:
Deactivate automatic filters. where i can do that?

Kontact 4.14.6
KMail 4.14.6
Plasma 5.8
Distibutor Neptune
Comment 4 Denis Kurz 2017-01-08 00:18:37 UTC
Sorry, Stefan, the version you use is still much too old.

Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.