[Dovecot] deliver + quota
Hi list,
can someone please explain me the following behaviour of deliver in combination with fs-quota and reading from stdin:
# repquota -a | grep ud_3p5 ud_3p5 -- 4464 10240 12288 10 0 0 # stat -c "%s" /tmp/mymail 4524853 so there's enough space for this mail
# su ud_3p5 -s/bin/sh -c "cat /tmp/mymail | /usr/libexec/dovecot/deliver -e; echo \$?" sda6: warning, user block quota exceeded. sda6: write failed, user block limit reached. Not enough disk space 77
vs.
# su ud_3p5 -s/bin/sh -c "/usr/libexec/dovecot/deliver -p /tmp/mymail -e; echo \$?" 0
Must have something to do with create_raw_stream inside deliver.c
System is running Dovecot v1.2.13
Thanks, / manuel
On Wed, 2010-10-27 at 19:52 +0200, Manuel Mausz wrote:
# su ud_3p5 -s/bin/sh -c "cat /tmp/mymail | /usr/libexec/dovecot/deliver -e; echo \$?" .. # su ud_3p5 -s/bin/sh -c "/usr/libexec/dovecot/deliver -p /tmp/mymail -e; echo \$?" 0
Must have something to do with create_raw_stream inside deliver.c
System is running Dovecot v1.2.13
Yeah. With v1.2 without -p parameter it's first creating a temporary file into the user's home dir, which increases quota. In v2.0 /tmp is again the default, but it's now configurable:
# Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. #mail_temp_dir = /tmp
The reason why it was moved away from /tmp in the first place was because someone complained that their /tmp was too small for it.
On 02.11.2010 16:49, Timo Sirainen wrote:
On Wed, 2010-10-27 at 19:52 +0200, Manuel Mausz wrote:
# su ud_3p5 -s/bin/sh -c "cat /tmp/mymail | /usr/libexec/dovecot/deliver -e; echo \$?" .. # su ud_3p5 -s/bin/sh -c "/usr/libexec/dovecot/deliver -p /tmp/mymail -e; echo \$?" 0 Must have something to do with create_raw_stream inside deliver.c
System is running Dovecot v1.2.13
Yeah. With v1.2 without -p parameter it's first creating a temporary file into the user's home dir, which increases quota. In v2.0 /tmp is again the default, but it's now configurable:
# Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. #mail_temp_dir = /tmp
The reason why it was moved away from /tmp in the first place was because someone complained that their /tmp was too small for it.
Hi Timo,
thanks for pointing that new configuration variable out. I've backported your patch to v1.2 and it's working fine now. I guess this temporary file is needed for supporting mbox but why is it needed for maildir?
thanks, / manuel
On 3.11.2010, at 10.16, Manuel Mausz wrote:
# Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. #mail_temp_dir = /tmp
thanks for pointing that new configuration variable out. I've backported your patch to v1.2 and it's working fine now. I guess this temporary file is needed for supporting mbox but why is it needed for maildir?
It's mainly needed for Sieve, which needs to be able to read the mail before it decides where it should be saved to. Hmm. I guess I could see about disabling it entirely when Sieve isn't used.
On 03.11.2010 11:31, Timo Sirainen wrote:
On 3.11.2010, at 10.16, Manuel Mausz wrote:
# Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. #mail_temp_dir = /tmp thanks for pointing that new configuration variable out. I've backported your patch to v1.2 and it's working fine now. I guess this temporary file is needed for supporting mbox but why is it needed for maildir?
It's mainly needed for Sieve, which needs to be able to read the mail before it decides where it should be saved to. Hmm. I guess I could see about disabling it entirely when Sieve isn't used. Isn't storing the mail inside Maildir/tmp sufficient for sieve? And then just hardlink (or copy, depending on the configuration) the file to Maildir/new or whatever sieve rules decides.
On Wed, 2010-11-03 at 11:38 +0100, Manuel Mausz wrote:
# Directory in which LDA/LMTP temporarily stores incoming mails >128 kB. #mail_temp_dir = /tmp thanks for pointing that new configuration variable out. I've backported your patch to v1.2 and it's working fine now. I guess this temporary file is needed for supporting mbox but why is it needed for maildir?
It's mainly needed for Sieve, which needs to be able to read the mail before it decides where it should be saved to. Hmm. I guess I could see about disabling it entirely when Sieve isn't used. Isn't storing the mail inside Maildir/tmp sufficient for sieve? And then just hardlink (or copy, depending on the configuration) the file to Maildir/new or whatever sieve rules decides.
Yeah. Unfortunately there's a ton of layers that make this difficult to implement. There are 3 different cases:
- No sieve -> it should be possible to just call mailbox_save() with the stdin input stream directly. I implemented this now to lda: http://hg.dovecot.org/dovecot-2.0/rev/b9487d271b72 http://hg.dovecot.org/dovecot-2.0/rev/fd44ba1fa729
Doing the same for LMTP would require more code.
With Sieve, but it either doesn't read message at all or reads less than the first 128 kB of it -> again there's no need to seek backwards (no need for temp file), so mailbox_save() should get an input stream that gets the already read data followed by not yet read stdio input stream. But that gets annoyingly difficult to implement.
With Sieve that read more than 128 kB of input -> temp file needs to be created. Yeah, it should be possible to hard link it into the final maildir message. It needs to have the correct file permissions set up (destination could be a shared mailbox), which gets a bit annoying to implement. Also the temp file needs to exist for the entire duration of the mail delivery, so if it crashes it leaves the temp file lying around (now the temp file is unlinked immediately after creation).
participants (2)
-
Manuel Mausz
-
Timo Sirainen