Hey, David

Thanks for resending the patches!

On Sun, Nov 06, 2011 at 06:34:27AM +0100, David Riebenbauer wrote:
>notmuch-deliver should not just fail, when splice() doesn't work. Fall
>back to the readwrite method even if NOTMUCH_DELIVER_NO_SPLICE is not
>set.

This is a trivial change but I'm rather curious about the reasoning.
Did you have a problem with splice() not working?

>---
> contrib/notmuch-deliver/src/main.c |   10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
>diff --git a/contrib/notmuch-deliver/src/main.c 
>b/contrib/notmuch-deliver/src/main.c
>index f7a4eaa..8423d91 100644
>--- a/contrib/notmuch-deliver/src/main.c
>+++ b/contrib/notmuch-deliver/src/main.c
>@@ -252,9 +252,13 @@ save_maildir(int fdin, const char *dir, int auto_create, 
>char **path)
>
>       g_debug("Reading from standard input and writing to `%s'", 
> info.tmpname);
> #ifdef HAVE_SPLICE
>-      ret = g_getenv("NOTMUCH_DELIVER_NO_SPLICE")
>-              ? save_readwrite(fdin, fdout)
>-              : save_splice(fdin, fdout);
>+      if (g_getenv("NOTMUCH_DELIVER_NO_SPLICE"))
>+              ret = save_readwrite(fdin, fdout);
>+      else {
>+              ret = save_splice(fdin, fdout);
>+              if (ret)
>+                      ret = save_readwrite(fdin, fdout);
>+      }

I'm inclined to think this retry should be user configurable as well.
How about we remove NOTMUCH_DELIVER_NO_SPLICE environment variable and
add a command line flag like --save-method which may have the following
invocations:

--save-method=readwrite        calls save_readwrite()
--save-method=splice           calls save_splice()
--save-method=readwrite,splice try save_readwrite() and then splice()
--save-method=splice,readwrite try save_splice and then readwrite()

The second invocation should fail in case splice is not available. Also
adding an environment variable like NOTMUCH_DELIVER_SAVE_METHOD so
people can stick it into their dotfiles is a good idea.

Thoughts?

                -alip

> #else
>       ret = save_readwrite(fdin, fdout);
> #endif /* HAVE_SPLICE */
>-- 
>1.7.7.1
>

Reply via email to