Bug 247895 - moved mail using filter is chmoded 600, on an IMAP server with umask set to 026
Summary: moved mail using filter is chmoded 600, on an IMAP server with umask set to 026
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kmail
Classification: Applications
Component: filtering (show other bugs)
Version: 1.13.5
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-14 21:43 UTC by Mathieu Roy
Modified: 2015-04-12 09:51 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 Mathieu Roy 2010-08-14 21:43:52 UTC
Version:           1.13.5 (using KDE 4.4.5) 
OS:                Linux

Hello,

The setup of my IMAP server is so that all incoming mails get filemode 640 (group readable), umask being defined as 026.
The IMAP server is dovecot as currently shipped on Debian stable.

Whenever I move, within Kmail over IMAP, a mail with drag and drop, the filemode 640 of the mail is preserved.

I created a filter that sole purpose is to move files to a specific directory whenever I use a given keyboard shortcut (alt-S, for instance). Actually, it also tags the mail - but that makes no difference, I made several tests, I tried removing the tagging part of the filter, keeping only the moving file part. 

I would have expected this filter to behave exactly like a drag n drop. But it does not, it actually create a new file on the IMAP server. 
For instance, I had one mail stored in a file 1281807134.P3217Q0M185114.moe:2,S. When I run the filter on it, it creates, while renaming 1281807134.P3217Q0M185114.moe:2,S into 1281807134.P3217Q0M185114.moe:2,ST, a new file called 1281813409.P3217Q1.moe:2,S.

diff between the two files returns:
44,45c44,45
< X-UID: 8470
< X-KMail-Filtered: 187622
---
> X-UID: 8469
> X-KMail-Filtered: 187620

Even if there are two files on the IMAP server, there is only one mail shown in kmail. I guess that's normal, I'm not familiar enough with IMAP to comment it.

But, and this is where I'm getting at, the new file 1281813409.P3217Q1.moe:2,S filemode is set to 600.

I do not know if kmail is at fault here. I wonder if the mail client is enabled to set filemode over IMAP, disregarding the IMAP server umask. So maybe it is a bug in dovecot that miss in some case to set properly the new filemode according to umask in its own configuration, please tell me.

Anyway, even if dovecot is faulty for wrongly setting the filemode unaccordlingly configured umask (which is not clear to me - if it is Kmail that somehow override dovecot umask, then it is an obvious bug), I would have expected kmail filter option "move to this directory" to behave exactly like the drag and drop.

What am I misunderstanding? :)
Do you need more info?

Reproducible: Always

Steps to Reproduce:
- Set up a filter which does only when thing: move selected mails to a given directory over IMAP.
- Select a mail, run the filter on it

Actual Results:  
- Check on the IMAP server, you should have two copies of the mail, the later being created by kmail filter, set in mode 600

Expected Results:  
- I would have expected to have a single copy of the mail as it would have happened if I had simply made a drag and drop.


Obviously, this bug have two parts:
 A - the filter move to X directory create a new file on the IMAP server
 B - this new file is not according to IMAP server umask, which I understand may be a bug in dovecot (in which case I'll fill a report against it too, tell me)

If kmail, not dovecot, is at fault in B, then fixing this part only would do the trick. I have no opinion about how kmail should handle filters, it surely have a purpose to create a new file whenever a filter is run, hence the specific X-KMail-Filtered and X-UID headers.

However, if kmail is not responsible for B, then it would be very useful to make it, at least, an option for filters to avoid creating new files. Say it may be useful to run filters not altering the message in any way, just like a drag and drop would have done.
Comment 1 Laurent Montel 2015-04-12 09:51:46 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.