Bug 154454

Summary: Incorrect IMAP folder size shown
Product: [Unmaintained] kmail Reporter: Rodney Baker <rodney.baker>
Component: IMAPAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: thorsten
Priority: NOR    
Version: enterprise   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rodney Baker 2007-12-22 00:36:37 UTC
Version:           1.9.6 (using KDE KDE 3.5.7)
Installed from:    SuSE RPMs
OS:                Linux

Running KMail with a dovecot IMAP server and using Maildir for mail storage. KMail talks to the IMAP server both locally and across a LAN.

The folder sizes reported in the folder list appear to bear no relationship to the actual size stored in the maildir. Two different machines (one local, one on the LAN) report different folder sizes for the same folders. The folder sizes increase when new messages are received and do not decrease when messages are deleted/expunged.

For example, my desktop machine reports the inbox size as being 917kB but the laptop reports only 6.5kB. I use the desktop machine much more than the laptop so KMail has opened a lot more mail there than on the laptop. The folder size appears related to the amount of mail actually read by KMail rather than the size of the folder in the mail store.
Comment 1 Rodney Baker 2007-12-22 00:37:24 UTC
BTW, the same symptoms have been seen with other IMAP servers as well - it is not limited to KMail's interaction with dovecot.
Comment 2 Mark Davies 2008-04-08 04:03:43 UTC
We see the same problem with kmail 1.9.9
Comment 3 Rodney Baker 2009-02-12 12:55:14 UTC
This bug is still present in version 1.11.0 (KDE 4.2).
Comment 4 Ingo Klöcker 2009-04-04 16:54:33 UTC
It is the size of the local cache (instead of the size of the folder on the server) that is shown as folder size.
Comment 5 Ingo Klöcker 2009-04-04 21:48:35 UTC
SVN commit 949275 by kloecker:

Calculate and show the correct folder size of IMAP folders.

BUG:154454


 M  +11 -12    folderstorage.cpp  
 M  +1 -1      folderstorage.h  
 M  +15 -0     kmfolderimap.cpp  
 M  +3 -0      kmfolderimap.h  
 M  +2 -2      kmfoldermaildir.cpp  
 M  +1 -1      kmfoldermbox.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=949275
Comment 6 Ingo Klöcker 2009-04-04 22:11:33 UTC
SVN commit 949286 by kloecker:

Backport revision 949275 to 4.2 branch
Calculate and show the correct folder size of IMAP folders.

CCBUG:154454



 M  +11 -12    folderstorage.cpp  
 M  +1 -1      folderstorage.h  
 M  +15 -0     kmfolderimap.cpp  
 M  +3 -0      kmfolderimap.h  
 M  +2 -2      kmfoldermaildir.cpp  
 M  +1 -1      kmfoldermbox.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=949286
Comment 7 Rodney Baker 2009-05-12 16:35:49 UTC
This is only partly working on version 1.11.3 (version 4.2.3 "release 116"). I am seeing the following behaviour now:

- 50 (or so) IMAP folders, most non-empty. All showed 0B folder size.
- Once a new, unread message was delivered to an IMAP folder, when the first unread message was read, the folder size was calculated and displayed correctly. All other folders that have not had a new, unread message delivered and read still show 0B.
- Deleting messages from folders that are showing the correct size sees the size decremented according to the size of the deleted messages (appears correct).
- The Trash folder size (also an IMAP folder) initially increments according to the size of the messages being moved into it, but then reverts to 0B once moving the messages has completed.

I have tried rebuilding the local IMAP caches with no effect (probably expected). Running 1.11.3 (KDE 4.2.3) on openSuse 11.0 with Dovecot 1.0.15-4.1.

Looks like progress but not quite there yet...
Comment 8 Rodney Baker 2009-05-12 16:58:53 UTC
Actually I've just realised that what I'm seeing is a little more subtle than what I described above. The folder size is calculated and shown when the number of messages shown for a particular folder (in the Total column) changes.

- I have some non-empty folders with no value shown in the Total messages column. If I click on those folders, the folder size is calculated and displayed.

- I have some non-empty folders showing a number of messages in the Total column; if I click on those folders the size remains at zero bytes, regardless of what I do, until a new message is delivered to that folder (via procmail).

- I have an empty folder showing zero bytes. I drag a read message from another folder (which is showing the correct folder size) to that empty folder. The Total message count is incremented by 1 but the size remains at zero. I drag another message into the folder; total count is now 2 but size remains at zero bytes. The size of the folder that I dragged the messages from is decremented by the size of the messages.

- I drag the messages back to their original folder. The Total count in the previously empty folder is back to zero. The Total count in the folder from where the messages originally came (which, remember, was showing the correct folder size) is incremented by 2 (as expected) but the folder size is now shown as 0 bytes (it was correct before I dragged the messages back).

I hope that description is clear. As I said, progress has definitely been made but something appears still to be not quite right. Let me know if I can do anything further to assist in tracking it down.
Comment 9 Rodney Baker 2009-05-12 17:12:55 UTC
Sorry to bug you again, but further refining my previous comments, if I drag messages between folders one at a time, the folder I am dragging the message *From* has the folder size calculated and displayed correctly as the message leaves the folder; the folder I drag the message *To* has its size set to and displayed as zero bytes. This is consistently repeatable across all IMAP folders.

So, to summarise:
Clicking on a folder that has newly delivered, unread messages will result in the folder size being calculated and displayed correctly.
Dragging a message between folders (or moving a message to Trash, where Trash is an IMAP folder) will result in the source folder having its size calculated and displayed correctly but the destination folder having its size reset to and displayed as zero bytes.

That is about as succinct as I can make it.
Comment 10 Rodney Baker 2009-06-04 14:36:29 UTC
Any further work on this? Still broken on 1.11.90 (Using KDE 4.2.88 (KDE 4.2.88 (KDE 4.3 >= 20090527)) "release 127")
Comment 11 Laurent Montel 2015-04-12 10:17:55 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.