Bug 39290 - inbox not being compacted
Summary: inbox not being compacted
Status: RESOLVED LATER
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR grave
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-12 09:33 UTC by Toivo Pedaste
Modified: 2007-09-14 12:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toivo Pedaste 2002-03-12 09:30:27 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kmail
Version:           CVS 11/3/2 (using KDE 2.9.2 CVS/CVSup/Snapshot)
Severity:          normal
Installed from:    Compiled sources
Compiler:          gcc
OS:                Linux
OS/Compiler notes: Not Specified

My inbox folder cann't be compacted
whatever I do my 27Meg inbox won't
shrink when I use compact or Compact
all folders if when I move all
the messages to another folder and
do the compact on the "empty" inbox.

(Submitted via bugs.kde.org)
Comment 1 Ingo Kl 2002-04-28 11:32:11 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 12 March 2002 10:30 toivo@ucs.uwa.edu.au wrote:
> My inbox folder can't be compacted
> whatever I do my 27Meg inbox won't
> shrink when I use compact or Compact
> all folders if when I move all
> the messages to another folder and
> do the compact on the "empty" inbox.

For some reason KMail seems to think that you inbox is not compactable.=20
Please try the following:

Move all messages from inbox to another folder.
Empty the inbox.
Exit KMail.
Open the KMail configuration file (~/.kde/share/config/kmailrc) in your
favourite editor and search for "[Folder-inbox]". Directly below this
line you'll see "Compactable=3Dtrue" or "Compactable=3Dfalse". In the
latter case change "false" to "true". Save the edited config file.
Start KMail.
Move all messages back to the inbox.

Now everything should work.

Regards
Ingo

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8y927GnR+RTDgudgRAjfyAJ9hpeqWpTW9OiF7E5d1DCoVgeGLuQCeN4Q2
f6EYGeCmmMrGGhPjJae/y8I=3D
=3DB6UV
-----END PGP SIGNATURE-----
Comment 2 Achim Bohnet 2003-03-12 16:21:16 UTC
Hi, 
 
I'm running kde 3.1 with and see exactly the same problem.  There also another kde 
user on debian with this problem.  See: 
http://lists.debian.org/debian-kde/2003/debian-kde-200303/msg00331.html 
 
Because the bug was reported for 2.9.2 and I'm on 3.1 it can't be fixed. 
Would be really nice 
if one would get a warning when one tries to compact an uncompactable folder 
or if compact is deactivated in the menues for uncompactable folder. 
 
 
ach@lost(0) ~ $ # delete some msg, try compact/expire/compact all folders, nothing 
happens: 
-rw-------    1 ach      ach      16221717 Mar 12 15:43 Mail/inbox 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:43 Mail/inbox 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:43 Mail/inbox 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:43 Mail/inbox 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:43 Mail/inbox 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:43 Mail/inbox 
 
Workaround the bug is to create a new folder, move all msg from 
inbox to new folder.  In inbox move all msg to trash and move the 
messges back: 
 
ach@lost(0) ~ $ # create new folder, move all msg to this folder 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:45 Mail/inbox 
ach@lost(0) ~ $ # compact inbox 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach      16221717 Mar 12 15:45 Mail/inbox 
ach@lost(0) ~ $ # move all msg to trash 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach             0 Mar 12 15:47 Mail/inbox 
ach@lost(0) ~ $ # move all msg from the other folder back 
ach@lost(0) ~ $ l Mail/inbox 
-rw-------    1 ach      ach       5365662 Mar 12 15:48 Mail/inbox 
 
Comment 3 Jordi Polo 2003-05-29 12:21:58 UTC
It happens to me also, still looking for a reason thought 
Comment 4 Stephan Kulow 2003-09-20 20:39:27 UTC
Achim, still can reproduce the problem with 3.1.3? I use maildir, so I can't say 
and with maildir it definitly works. 
Comment 5 Malte S. Stretz 2003-09-20 23:28:16 UTC
This might be related to my bug 43773. I think Till was working on that one 
some months ago... 
Comment 6 Achim Bohnet 2003-09-21 10:04:30 UTC
Hi Stefan, 
I'm running 3.14 now and moved by inbox and several others to use maildir. 
I've only one old mbox folder compactable=false. I've deleted one msg their, 
called compact and (as I now expect) the size did not change. 
 
I did a quick grep on an server with KDE 3.1.3 and found 5 out of 65 inboxes 
with 
compactable=false (2 mbox and 3 maildir in format).  Together 
there are 26 line with ^Compactable=false in the all kmailrc. 
 
Let me know if and what information you'll need and I contact the users 
to get their okay to collect the information. 
 
Achim 
Comment 7 Stephan Kulow 2003-09-24 16:44:58 UTC
I assume you use some kind of NFS, right? (that makes index out of sync much more likely) 
Comment 8 Achim Bohnet 2003-09-24 17:11:18 UTC
Hi Coolo, 
no, sorry. no NFS on those hosts. home partions are all ext3 
with default mount options.  kernels 2.4.18 ... 2.4.21 over the time 
of this bug report. 
Comment 9 noster 2003-11-05 20:49:39 UTC
If I understood problem correctly it doesn't seem to affect the 1.5.93 [KDE 3.1.93 (CVS>=20031028)] version. I've tried to replicate the bug several times on ~100 mail messages in folder in maildir fromat. The directory size was affected each time I removed the messages and selected "compact folder" option. The only unaffected file was folder.index [+index.sorted] but also until emptying the folder.

To check everything out I've also created another folder in mbox format and copied some messages. Compacting also worked correctly on this folder.

Each folder in my kmailrc was set compactable=true by default.

I must admit that I have clean kde installation [from cvs] and thus other people might have different experiences.

Comment 10 gerard 2003-11-05 23:04:16 UTC
I am on KDE 3.2 beta (home compiled), and this problem is still not solved.
My inbox is 43 Mo big, for 100 messages. Impossible to compact it. the other forders are compacted when I quit. (I made Compactable=true)
It is the same when using french or english language.
The only way I can get my inbox empty is to move all the messages to another folder, then clicking on "Move all messages to trash".
Comment 11 Till Adam 2003-12-28 01:15:27 UTC
Subject: kdepim/kmail

CVS commit by tilladam: 

Handle empty lines before the first mbox delimiter gracefully. This fixes
compaction of notoriously non-compactible mboxes.

Don't reset the needCompacting flag until the compaction has actually
suceeded.

CCMAIL: 39290-done@bugs.kde.org
CCMAIL: 43773-done@bugs.kde.org

One cookie my way, please.


  M +2 -2      kmfoldermbox.cpp   1.91


--- kdepim/kmail/kmfoldermbox.cpp  #1.90:1.91
@@ -1156,5 +1156,5 @@ int KMFolderMbox::compact()
       fread(mtext.data(), 20, 1, mStream);
       if(i <= 0) { //woops we've reached the top of the file, last try..
-        if(!strncasecmp(mtext.data(), "from ", 5)) {
+        if ( mtext.contains( "from ", false ) ) {
           if (mtext.size() < (size_t)folder_offset)
               mtext.resize(folder_offset);
@@ -1222,4 +1222,5 @@ int KMFolderMbox::compact()
     close(true);
     mAutoCreateIndex = autoCreate;
+    needsCompact = false;             // We are clean now
   }
   else
@@ -1237,5 +1238,4 @@ int KMFolderMbox::compact()
   }
   emit changed();
-  needsCompact = false;             // We are clean now
   return 0;
 


Comment 12 Ingo Klöcker 2003-12-28 13:04:59 UTC
Reopened because this problem is unfortunately still there. The reason for this is the following code in kmfolder.cpp:
  // sanity check
  if (mCompactable && (!msg || (msg->subject().isEmpty() != mbSubject.isEmpty()))) {
    kdDebug(5006) << "Error: " << location() <<
      " Index file is inconsistent with folder file. This should never happen." << endl;
    mCompactable = FALSE; // Don't compact

Instead of marking a folder as non-compactable we have to regenerate the index. But we should have some smart index recovery code so that the message status and probably other information isn't unnecessarily lost during index regeneration. But that's for after KDE 3.2.
Comment 13 Ingo Klöcker 2003-12-28 13:05:38 UTC
As I wrote this can't be fixed for KDE 3.2.