From e6c5494d8013fde174c2022e2268d80b244526a2 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 22 Nov 2014 09:28:51 +0000 Subject: [PATCH] exim pipe transport, notmuch insert and mbox-style messages --- 46/7c7215157ebc769abec793a6c5995f95e22139 | 113 ++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 46/7c7215157ebc769abec793a6c5995f95e22139 diff --git a/46/7c7215157ebc769abec793a6c5995f95e22139 b/46/7c7215157ebc769abec793a6c5995f95e22139 new file mode 100644 index 000000000..52cc0866e --- /dev/null +++ b/46/7c7215157ebc769abec793a6c5995f95e22139 @@ -0,0 +1,113 @@ +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 51C72431FBF + for ; Sat, 22 Nov 2014 01:28:59 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 vaAMix5hXE5Z for ; + Sat, 22 Nov 2014 01:28:54 -0800 (PST) +Received: from 4angle.com (4angle.com [82.145.46.9]) + (using TLSv1 with cipher AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C5B82431FBC + for ; Sat, 22 Nov 2014 01:28:54 -0800 (PST) +Received: from cpc19-cmbg14-2-0-cust212.5-4.cable.virginm.net ([86.6.30.213] + helo=x230) + by 4angle.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) + (Exim 4.82) (envelope-from ) id 1Xs6zo-0006Jj-Pg + for notmuch@notmuchmail.org; Sat, 22 Nov 2014 09:28:48 +0000 +Received: from edward by x230 with local (Exim 4.85_RC1-XX) + (envelope-from ) id 1Xs6zr-00045a-9v + for notmuch@notmuchmail.org; Sat, 22 Nov 2014 09:28:51 +0000 +Date: Sat, 22 Nov 2014 09:28:51 +0000 +From: Edward Betts +To: notmuch@notmuchmail.org +Subject: exim pipe transport, notmuch insert and mbox-style messages +Message-ID: <20141122092851.GA31815@x230> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) +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: Sat, 22 Nov 2014 09:28:59 -0000 + +My mail arrives on a Debian machine running exim. It was being filtered +by procmail then piped into 'notmuch insert'. This was generating the +single-message mbox warning: + +> Warning: ... is an mbox containing a single message, +> likely caused by misconfigured mail delivery. Support for single-message +> mboxes is deprecated and may be removed in the future. + +I thought it was a problem with procmail delivering mbox style messages to +pipes, so I switched to maildrop. Same problem. This warning is produced +because there is an mbox-style From_ line before the first header line. Here +is an example: + +> From MAILER-DAEMON Fri Jul 8 12:08:34 2011 + +The man page for maildrop says this style of message isn't supported, but it +doesn't detect and warn about them. It will pipe them into commands without +removing the From_ line. + +Reading the exim documentation for pipe transports I found the message_prefix +option, which is by default is set like this: + +> message_prefix = \ +> From ${if def:return_path{$return_path}{MAILER-DAEMON}}\ +> ${tod_bsdinbox}\n + +This means that exim turns all messages into mbox style messages before +delivering them to a pipe. The justification given in the documentation is +"This is required by the commonly used /usr/bin/vacation program." + +The fix is to unset the exim message_prefix option for delivery to maildrop. +Here is an example of the Debian exim maildrop_pipe transport with a blank +message_prefix to stop the From_ line being added before the message is piped +to maildrop. + +> maildrop_pipe: +> debug_print = "T: maildrop_pipe for $local_part@$domain" +> driver = pipe +> path = "/bin:/usr/bin:/usr/local/bin" +> command = "/usr/bin/maildrop" +> message_prefix = +> message_suffix = +> return_path_add +> delivery_date_add +> envelope_to_add + +The same fix could be applied for procmail pipe or a pipe from exim to +'notmuch insert'. + +I submitted a Debian bug for exim4-config with my change as a patch. The +maintainer has excepted my patch and uploaded a release of exim4-config with +the fix to Debian experimental. + +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769396 + +I wonder if 'notmuch insert' could be modified to detect and drop the From_ +line before writing the message to disk and index it. It could do that +silently or with a warning. + +-- +Edward. -- 2.26.2