[PATCH] test: attempt to send QUIT to smtp-dummy in case mail send failed

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Sat Nov 12 23:01:24 PST 2011


On Sat, 12 Nov 2011 23:07:38 +0200, Tomi Ollila <tomi.ollila at iki.fi> wrote:
> On Sat, 12 Nov 2011 10:41:28 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> > 
> > Actually, since sending mail is synchronous, there shouldn't be any
> > issues with buffering or timing.  If Emacs successfully sends the
> > message, it will wait for the OK response (`smtpmail-via-smtp'), which
> > should indicate that the message is in stable storage on the SMTP
> > server (this is rather fundamental to SMTP's reliability as a
> > protocol, after all).  Thus, the smtp-dummy *should* be done by the
> > time Emacs exits.  If Emacs fails to send the message, then it doesn't
> > really matter and you just want the smtp-dummy to go away.
> > 
> > I say "should" because smtp-dummy needs a one line patch to add an
> > fflush at the end of receive_data_to_file.  Any real SMTP server would
> > do this (not to mention a full fsync) before acknowledging the
> > message.
> 
> SO, in our cases there are 2 options:
> 
> 
> 1) add line 
> 	{ echo QUIT > /dev/tcp/127.0.0.1/25025; } 2>/dev/null
>   before 
> 	wait ${smtp_dummy_pid}
> 
> in test-lib.sh
> 
> 
> 2) add line
> 	kill ${smtp_dummy_pid}
>   before 
> 	wait ${smtp_dummy_pid}
> 
> in test-lib.sh *and* add that fflush (output) before free (line) in 
> smtp-dummy.c function receive_data_to_file.
> 
> folks! opinions!
> 

I think we should add fflush(3) call to smtp-dummy in any case.

As for sending QUIT over TCP vs kill, I prefer the former.  On one hand,
kill is more reliable.  But smtp-dummy must handle QUIT and it is a bug
if it does not.

An unrelated issue: currently we discard test_emacs output in
emacs_deliver_message and other cases.  Ideally we should not do that
because it may contain useful information.  We should capture the output
and print it in case of error, at least.

Regards,
  Dmitry

> Tomi
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list