Quoting Timo Sirainen:
Oh. I would suggest a config switch (yes, yet another one) that tells dovecot to do the same. Most clients don't care about it, anyway, and if you tell your LDA to use crlf, dovecot would even do the right thing. Maybe.. I think plugin would be best though, since I don't really like adding options to intentionally break RFC.
It would not break RFC if the LDA adds crlf (e.g., Exim's builtin MDA can do that).
Anyway I don't think it should be that problematic if the cache file works properly. It probably doesn't even add all that much extra disk I/O since the client will just download the new mails anyway, so as long as they stay in kernel's buffer cache long enough there's no problem. Well, except for a bit of extra CPU usage.
That's all ok at the average site (and therefore most installations), but it could give some benefit to large sites. But they should be able to pay for such a feature, so we probably don't have to care about that. :)
Oh and CVS HEAD deliver stores the message sizes directly into cache, so it won't be a problem at all with it. :)
Oh. I was already tempted to use dovecot-deliver, now even more :) The only thing I really dislike: Why do deliver send it's own bounces? As I understand a LDA, it tells the MTA by means of the exit code if the delivery was successful or not, so the MTA can decide what to do (e.g. after tempfail, try again later or freeze the message). And I don't even know under which circumstances deliver bounces, as it appears to sometimes use the tempfail exit code.
Hm, how does dovecot know that a message contains crlf, so it can use sendfile instead of read/write? If you have some kind of simple autodetection, like "read the first line, if it contains crlf, assume all other lines also do", we already have some (non-optimized) form of that. I guess this also affects IMAP, right? There's no simple autodetection. There's a "message is binary safe" flag in cache file that gets set after the message has once been parsed and only CRLF-linefeeds were seen.
Oh. So dovecot-deliver could already do that? (maybe it already honours the mail_save_crlf?)