[Dovecot] "pipe" plugin - is anyone interested (or using it)?

Timo Sirainen tss at iki.fi
Wed Dec 5 21:45:35 EET 2007


On Wed, 2007-12-05 at 15:29 +0100, Nicolas Boullis wrote:
> Timo, on my first message, you seemed to be interested to merge such a
> feature (see http://dovecot.org/pipermail/dovecot/2007-May/023055.html
> ). Are you still interested?

I downloaded it when you first mentioned it, but looks like I never got
around to actually looking at it. Yes, something like this would be
nice..

One thing at least that should be changed is to configure it using
virtual mailbox names instead of full mailbox paths. This isn't really
possible with v1.0, but v1.1 should make it pretty easy.

A few things about the code:

	save_dest_mail = mail_alloc(ctx->transaction,
				    MAIL_FETCH_PHYSICAL_SIZE, NULL);

Quota plugin wanted to know the message's physical size, but your plugin
doesn't need it. So you could just use 0 instead of
MAIL_FETCH_PHYSICAL_SIZE.

I think write() can return partially written data if the other side
isn't reading it fast enough. Using write_full() instead would anyway be
better/safer.

Do you really need to wait for the executed process to finish? Since
this is the only plugin currently creating child processes, I'd setup a
SIGCHLD handler and waitpid() there to get rid of the zombie:
lib_signals_set_handler(SIGCHLD, TRUE, chld_handler, NULL);

Multiple commands are now processed sequentially. I don't know if
there's real need for multiple commands, but it would be faster to read
the message input just once and send it to all pipes in parallel.

"return 0 * WEXITSTATUS(status);" returns always 0 :)

I'd also leave stderr as-is for the child process so it could log
errors, and for handling syscall failures use:
i_fatal("dup2() failed: %m");

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20071205/b7f14326/attachment.bin 


More information about the dovecot mailing list