Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 254AF429E21 for ; Sun, 6 Nov 2011 01:01:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dJd-t9pDECBq for ; Sun, 6 Nov 2011 01:01:35 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 6BD9B431FB6 for ; Sun, 6 Nov 2011 01:01:35 -0700 (PDT) Received: by faan15 with SMTP id n15so1281066faa.26 for ; Sun, 06 Nov 2011 01:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=AAFXlFPXqwGGS/4ce6D0k/m8+aQrBtI9kROfEJfG9jk=; b=TDtrA66X2wf0lR5406MBxRF47v/+rgztwVTQZL6NpfGC4zLOXlxE0iL/mAtM2t6NAl yYEofU/MVck7H7/fBNRi8NN9KHSUkZDdG6+vljb8LwF91yGZJoxRnAaMW+a/GnQL3DjQ tf6Xwf32TDyDikC3qVTU/yh9N2YrXkj5OdW+Y= Received: by 10.152.102.138 with SMTP id fo10mr4043481lab.44.1320566493739; Sun, 06 Nov 2011 01:01:33 -0700 (PDT) Received: from localhost ([88.251.190.249]) by mx.google.com with ESMTPS id po16sm4902581lab.2.2011.11.06.01.01.30 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Nov 2011 01:01:31 -0700 (PDT) Date: Sun, 6 Nov 2011 10:01:26 +0200 From: Ali Polatel To: David Riebenbauer Subject: Re: [PATCH 1/2] notmuch-deliver: Retry with readwrite if splice() fails Message-ID: <20111106080126.GA14031@hayalet> Mail-Followup-To: David Riebenbauer , Notmuch Mailing List References: <1320557668-2314-1-git-send-email-davrieb@liegesta.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1320557668-2314-1-git-send-email-davrieb@liegesta.at> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Notmuch Mailing List X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 08:01:37 -0000 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 >