Bug 151803 - Problems with folder permissions
Summary: Problems with folder permissions
Status: RESOLVED WORKSFORME
Alias: None
Product: kmail
Classification: Applications
Component: maildir (show other bugs)
Version: 1.9.8
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-03 11:45 UTC by Hans-J. Ullrich
Modified: 2007-11-05 16:32 UTC (History)
0 users

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 Hans-J. Ullrich 2007-11-03 11:45:14 UTC
Version:            (using KDE KDE 3.5.8)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Dear maintainers, 

(This bug is identical to Debian Bugnumber #449118)

I have sadly to report several heavy bugs in kmail. This is the list:

1. The folder "trash" can not be deleted. It seems, the mails are deleted,
but they are NOT. The size of the file ~/Mail/trash should be set to zero
with an empty trash, but it is NOT. The mails are staying in this folder.
Besides this, this is also a security problem, as mails will never be
securely deleted (and other persons might take a look at it)

2. The content of the "sent-mail" folder can not be deleted. The same
behavior as desribed above, with one exception: 

When trying to push the LAST(!) Mail into the trash, kmail crashes with segfault.

or

When trying to delete the LAST Mail directly, this is not possible. 
  
3. The content of folder "drafts" are no more shown, although it is still
existing in ~/Mail/drafts.

4. Please check: I suppose, the access-rights are not set correctly by
default ( I never changed them manually). ~/Mail/outbox, ~/Mail/sentmail 
and ~/Mail/trash got 0600, but ~/Mail/drafts got 0644.


Maybe this might help: I tried to manually set the filesize of "trash" to zero
(avoiding, some content might to inhibit the deleting), but I had no
success.

I manually changed the rights of those files to 0666, but again, no success.

At last I set all filesizes manually to zero (of course backing up the old
ones before), and tested with normal mails, to avoid, special contents of
some mails might cause the bugs. Again, I had no success.

Hint: These bugs seem to be in kmail already since a long time, as mails in
~/Mails/trash are pretty old. It was just random, I discoverd the bugs. 

Please feel free to ask for further information.

Best regards

Hans
Comment 1 Thomas McGuire 2007-11-04 18:27:05 UTC
>When trying to push the LAST(!) Mail into the trash, kmail crashes with segfault. 
Please provide a backtrace of this, see http://techbase.kde.org/Development/Tutorials/Debugging/How_to_create_useful_crash_reports .

>I tried to manually set the file size of "trash" to zero
I don't understand what you mean with this sentence. What exactly did you try to do?

It seems that you have some sort of setup problem. Try to quit KMail, then delete the ~/Mail folder completely (after backing it up somewhere else, of course!). Then restart KMail and see if you still got the same problems. It should work fine then.

Have you got any other mail program running at the same time? Did you restore you mail folder from some kind of backup?
Comment 2 Hans-J. Ullrich 2007-11-04 22:39:52 UTC
Am Sonntag 04 November 2007 schrieb Thomas McGuire:
[bugs.kde.org quoted mail]
Now I understand, why you ask. I removed the whole directory ~/M ail, and 
started kmail new. I checked, and dicovered now a new directory "drafts" 
and "trash" with some subdirectories "cur", "new" and "tmp".  This is new ! 
Before it, there was only a FILE with the name "drafts" and one with "trash". 
To explain it, this is my directory listing.

------- snip ---------

drwxr-xr-x   7 ullhan63 ullhan63      4096 2007-11-04 22:29 .
drwxr-xr-x 241 ullhan63 ullhan63     12288 2007-11-04 22:20 ..
-rw-r--r--   1 ullhan63 ullhan63     94415 2007-11-04 22:20 drafts
drwxr-xr-x   2 ullhan63 ullhan63      4096 2004-08-27 20:07 .drafts.directory
-rw-------   1 ullhan63 ullhan63        33 2007-11-04 22:20 .drafts.index
-rw-r--r--   1 ullhan63 ullhan63        33 2007-11-04 22:20 .drafts.index.ids
drwx------   5 ullhan63 ullhan63      4096 2007-11-04 22:21 inbox
-rw-------   1 ullhan63 ullhan63      2405 2007-11-04 22:21 .inbox.index
-rw-r--r--   1 ullhan63 ullhan63        69 2007-11-04 22:21 .inbox.index.ids
-rw-r--r--   1 ullhan63 ullhan63       417 2007-11-04 
22:21 .inbox.index.sorted
drwx------   2 ullhan63 ullhan63      4096 2007-05-24 
22:54 .KMail-Import.direct                                                                                                
ory
-rw-r--r--   1 ullhan63 ullhan63        33 2007-05-24 
22:54 .KMail-Import.index.                                                                                                
ids
drwx------   3 ullhan63 ullhan63      4096 2007-09-06 17:29 .Kunden.directory
-rw-------   1 ullhan63 ullhan63         0 2007-11-04 22:20 outbox
-rw-------   1 ullhan63 ullhan63        33 2007-11-04 22:20 .outbox.index
-rw-r--r--   1 ullhan63 ullhan63        33 2007-11-04 22:20 .outbox.index.ids
-rw-------   1 ullhan63 ullhan63        33 2007-11-04 22:20 .outlook-izn.index
-rw-r--r--   1 ullhan63 ullhan63        33 2007-11-04 
22:20 .outlook-izn.index.i                                                                                                
ds
-rw-------   1 ullhan63 ullhan63         0 2007-11-03 19:07 sent-mail
-rw-------   1 ullhan63 ullhan63        33 2007-11-03 19:07 .sent-mail.index
-rw-r--r--   1 ullhan63 ullhan63        33 2007-11-03 
19:07 .sent-mail.index.ids
drwx------   5 ullhan63 ullhan63      4096 2007-11-04 22:20 templates
-rw-------   1 ullhan63 ullhan63        33 2007-11-04 22:20 .templates.index
-rw-r--r--   1 ullhan63 ullhan63        33 2007-11-04 
22:20 .templates.index.ids
-rw-------   1 ullhan63 ullhan63 254946906 2007-11-04 22:21 trash
-rw-------   1 ullhan63 ullhan63        33 2007-11-04 22:21 .trash.index
-rw-r--r--   1 ullhan63 ullhan63        33 2007-11-04 22:21 .trash.index.ids

------------ snap -----------------

You see, there is a FILE  "trash" , not a DIRECTORY. This file is huge ! And 
it was this file, I set to a size of zero. IMO it should got the size of 
zero, whenever I deleted the whole folder "trash" (in the GUI of kmail).
As I  NEVER chenged anything manually below ~/Mail/, 
I could only imagine, this structure is because I am using kmail now for many 
years. Of course, I could delete ~/Mail, but I have a lot of Mails, I cannot 
delete and loose them. So, any idea, how I could import them ? 



> It seems that you have some sort of setup problem. Try to quit KMail, then
> delete the ~/Mail folder completely (after backing it up somewhere else, of
> course!). Then restart KMail and see if you still got the same problems. It
> should work fine then.
>

Yes, this is what I tessted (see above)

> Have you got any other mail program running at the same time? Did you
> restore you mail folder from some kind of backup?


No, I did not.

Best regards

Hans

P.S. I checked this at my other computer (Debian sid, i386), and at this 
computer ther is the SAME structure as told above.
Comment 3 Thomas McGuire 2007-11-05 08:50:44 UTC
Ah, I see what happened.
For some reason, your old mail format was MBOX. The mbox format stores all mails of one folder in one big file. For performance reasons, when you delete a mail from an mbox folder, the mail is not removed from disk, since that would mean the rest of the mails in the MBOX file would need to change position, which is very slow for large mboxes. You can however "compact" a mbox folder, which should remove all deleted mails. See also bug 94992.

I think having a "special" folder like inbox, outbox, drafts, trash and sent-mail in MBOX format is no longer supported by newer KMail versions, so you'll get problems with that.

The format KMail now uses is maildir, and that is the recommended format. In maildir format, each folder has three subfolders on disk (cur, new, tmp), and each mail should be one file in cur.

I suggest you use the new maildir format and import your old mails with File->Import Messages. If that does not work, there is another trick to get your old mails from the mbox files back: Create a new subfolder in KMail, which gives you the ability to chose MBOX format. Then quit KMail and replace the MBOX file which was just created with one of your old MBOX files (rename it to the correct name of course).

If that works, I think this bug can be closed.
Comment 4 Hans-J. Ullrich 2007-11-05 09:56:57 UTC
Am Montag 05 November 2007 schrieb Thomas McGuire:
[bugs.kde.org quoted mail]

Yes, this is explaining it.
> I think having a "special" folder like inbox, outbox, drafts, trash and
> sent-mail in MBOX format is no longer supported by newer KMail versions, so
> you'll get problems with that.
>

I deleted the mbox files and kmail created new directories in maildir format. 
There are no problems.

> The format KMail now uses is maildir, and that is the recommended format.
> In maildir format, each folder has three subfolders on disk (cur, new,
> tmp), and each mail should be one file in cur.
>
> I suggest you use the new maildir format and import your old mails with
> File->Import Messages. If that does not work, there is another trick to get
> your old mails from the mbox files back: Create a new subfolder in KMail,
> which gives you the ability to chose MBOX format. Then quit KMail and
> replace the MBOX file which was just created with one of your old MBOX
> files (rename it to the correct name of course).
>


I got another solution meanwhile: After creating the maildir directories as 
described above, I created  a new local postbox for receiving my mails. Then 
I read the files ("trash" and so on) and pushed the required drafts manually 
in folder ~/Mail/drafts. No problems.  
> If that works, I think this bug can be closed.


Yes, you can safely close this bug. I am happy, we got not only a solution, 
but a reason for this behaviour as well. 

Thank you all very much for your help. This is a good example, why I like 
linux now since many years: There is nothing weired, if something is not 
working, the problem is FAST solved, but people are always are telling, WHY 
it is not working and giving much information. In short words "OPEN" source.

Again: Thank you very much !

Regards

Hans
 
Comment 5 Thomas McGuire 2007-11-05 16:32:40 UTC
Glad I could help you. Closing the bug report then.