Bug 290589 - Opening a folder in kmail2 produces an error message
Summary: Opening a folder in kmail2 produces an error message
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: folders (show other bugs)
Version: 4.7
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-04 13:02 UTC by Dr. Christoph Pospiech
Modified: 2012-03-03 21:01 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screen shot of the kmail message (8.08 KB, image/jpeg)
2012-01-13 11:39 UTC, Dr. Christoph Pospiech
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Christoph Pospiech 2012-01-04 13:02:53 UTC
Version:           4.7 (using KDE 4.7.3) 
OS:                Linux

Opening a mail folder produces the error message
Local Folders: Maildir " for collection" is invalid
The folder, however, opens normally. 

Reproducible: Always

Steps to Reproduce:
Open kmail, click on a mail folder. There are a few folders which do not produce the error message.

Actual Results:  
Opening a mail folder produces the error message
Local Folders: Maildir " for collection" is invalid
The folder, however, opens normally. 

Expected Results:  
No error message.

OS: Linux (i686) release 3.0.0-14-generic
Compiler: gcc
Comment 1 Laurent Montel 2012-01-13 11:21:37 UTC
screenshot please
Comment 2 Dr. Christoph Pospiech 2012-01-13 11:39:41 UTC
Created attachment 67779 [details]
Screen shot of the kmail message

As requested here is the screen shot of the message produced by kmail2.
Comment 3 Dr. Christoph Pospiech 2012-01-15 09:21:56 UTC
One more thing - I just happened to do an aconadictl stop/start on the command line, and now aconadi is sprouting additional messages on the screen. I then reproduced the error as described above, and this is what aconadi is reporting about it.

AkonadiAgentServer(4724) MaildirResource::maildirForCollection: Got incomplete ancestor chain: Collection ID: 43    remote ID: "" 
   name: "BGP" 
   url: KUrl("akonadi:?collection=43") 
   parent: 39 "" 
   resource: "akonadi_maildir_resource_22" 
   rights: QFlags(0x1|0x2|0x4|0x8|0x10|0x20) 
   contents mime type: ("message/rfc822", "inode/directory") 
    CachePolicy:  
   inherit: true 
   interval: -1 
   timeout: 1 
   sync on demand: true 
   local parts: ("ENVELOPE") 
    CollectionStatistics: 
   count: -1 
   unread count: -1 
   size: -1 

Hope that helps !

Christoph Pospiech
Comment 4 Dr. Christoph Pospiech 2012-02-07 17:02:26 UTC
Hi I just posted a question about the correct akonadi configuration in http://forum.kde.org/viewtopic.php?f=215&t=99000 . Could it be that this bug is related with this question ?

Christoph Pospiech
Comment 5 András Manţia 2012-02-12 00:03:23 UTC
For some reason looks like your akonadi database is corrupted. Try to add again a maildir account pointing to the same folder and if it works, remove the first account (from Configure KMail->Accounts).
Comment 6 Dr. Christoph Pospiech 2012-02-12 17:28:22 UTC
Hi,

I just posted the following to http://forum.kde.org/viewtopic.php?f=215&t=99000&p=213395#p213395. As this deals with fixing my corrupted akonadi data base, I am quoting this here for convenience. Can anyone help me with the questions posted below ?
--- quote ---
Apparently, my only mail copy exists in the (akonadi ? nepomuk ?) data base, which knows the folder the mail is stored in and uses a number that points to a file name in ~/.local/share/akonadi/file_db_data/<this_number>_r0. So I need to recreate the local folder structure (which currently is an almost empty mail dir) from there. My plan would be to recreate the folder structure in a place where neither kmail2 nor akonadi knows about, then stop akonadi-server and switch the "Local Folders" to the new place. Sounds like a plan ? Well, I guess I still need some advice on how to precisely do this. For instance, can I create a new account in kmail->Settings->Configure kmail->Accounts->Receiving and point it to an existing mail dir structure (without kmail2 or akonadi getting confused about it) ?

Also, I can't recreate 19000 mails by hand, just using akonadiconsole->Browser for inspecting and a bash, mkdir, cp and chmod for recreating. I have to write a (C/C++) program or (perl ?) script for doing this. To this end I installed libakonadi-dev and started to inspect the header files in /usr/include/akonadi/private/ for an appropriate API that I could use. It seems as these header files define the d-bus interface (and such). I rather need to do SQL queries into the data base to retrieve the folder structure. Is libnepomuk-perl the right thing to use ? Unfortunately, /usr/lib/perl5/Nepomuk.pm is VERY short - only init() and normalize_classname() - not the SQL querys I was looking for. Can anyone point me to some documentation or get me started here ?

Thanks in advance !!
--- unquote ---
Christoph Pospiech
Comment 7 Dr. Christoph Pospiech 2012-03-03 21:01:20 UTC
Hi,

apparently, I solved the problem.

For some reason (yet unknown) the sub directories in local-mail got lost. I could be that I myself deleted them early after migration. Then kmail2 apparently stores everything in cache as it cannnot store it in local-mail.

As the the subdirectory is not there, kmail2 throws the error message as reported. Since the emails are still in the cache of the data base (aka data field in parttable from database akonadi), they can still be shown in kmail2.

I wrote a perl script with DBI::mysql API that extracts the local-mail directory structure from the aconadi data base and recreates it. It also reads the emails in akonadi cache (aka data field in parttable from database akonadi) and moves the emails to their proper place in local-mail.

After running the script, I re-created the akonadi data base. kmail2 now runs smoothly and the error message no longer shows up.

Christoph Pospiech