From 09e53d4383550fd3be40ed6659b20038ea86c814 Mon Sep 17 00:00:00 2001 From: Andreas Amann Date: Tue, 27 May 2014 09:35:33 +0100 Subject: [PATCH] notmuch new: emails with BOM are ignored --- 3d/f9d47984540d3a23d02b74ec90f636e2f6cbc6 | 104 ++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 3d/f9d47984540d3a23d02b74ec90f636e2f6cbc6 diff --git a/3d/f9d47984540d3a23d02b74ec90f636e2f6cbc6 b/3d/f9d47984540d3a23d02b74ec90f636e2f6cbc6 new file mode 100644 index 000000000..dab7aec2f --- /dev/null +++ b/3d/f9d47984540d3a23d02b74ec90f636e2f6cbc6 @@ -0,0 +1,104 @@ +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 D57A6431FBD + for ; Tue, 27 May 2014 01:50:41 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 xRJiPUwK6stO for ; + Tue, 27 May 2014 01:50:34 -0700 (PDT) +X-Greylist: delayed 892 seconds by postgrey-1.32 at olra; + Tue, 27 May 2014 01:50:34 PDT +Received: from emea01-am1-obe.outbound.protection.outlook.com + (mail-am1lp0017.outbound.protection.outlook.com [213.199.154.17]) + (using TLSv1 with cipher AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 45BC5431FAF + for ; Tue, 27 May 2014 01:50:34 -0700 (PDT) +Received: from AM1FFO11FD011.protection.gbl (10.174.64.31) by + AM1FFO11HUB010.protection.gbl (10.174.64.138) with Microsoft SMTP + Server (TLS) id 15.0.949.9; Tue, 27 May 2014 08:35:37 +0000 +Received: from mail4.ucc.ie (143.239.1.24) by + AM1FFO11FD011.mail.protection.outlook.com (10.174.65.100) with + Microsoft SMTP Server (TLS) id 15.0.949.9 via Frontend Transport; + Tue, 27 May 2014 08:35:37 +0000 +Received: from msstf091.ucc.ie (msstf091.ucc.ie [143.239.76.91]) + by mail4.ucc.ie (8.14.4/8.14.4) with ESMTP id s4R8ZYon020133 + for ; Tue, 27 May 2014 09:35:36 +0100 +Received: by msstf091.ucc.ie (Postfix, from userid 1000) + id CBCCEA2E13; Tue, 27 May 2014 09:35:33 +0100 (IST) +From: Andreas Amann +To: +Subject: notmuch new: emails with BOM are ignored +User-Agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +Date: Tue, 27 May 2014 09:35:33 +0100 +Message-ID: <874n0b4o16.fsf@msstf091.ucc.ie> +MIME-Version: 1.0 +Content-Type: text/plain +X-EOPAttributedMessage: 0 +X-Forefront-Antispam-Report: CIP:143.239.1.24; CTRY:IE; IPV:NLI; IPV:NLI; + EFV:NLI; SFV:NSPM; + SFS:(6009001)(438001)(189002)(199002)(80022001)(20776003)(6806004)(76482001)(81542001)(48376002)(83322001)(81342001)(19580395003)(45336002)(64706001)(79102001)(40036003)(50466002)(44976005)(77982001)(92726001)(54356999)(86362001)(87936001)(102836001)(50986999)(74502001)(92566001)(4396001)(74662001)(74482001)(31966008)(21056001)(85852003)(83506001)(83072002)(46102001)(42186004)(46386002)(99396002)(36756003)(33646001)(52956003)(90966001); DIR:OUT; SFP:; SCL:1; SRVR:AM1FFO11HUB010; H:mail4.ucc.ie; FPR:; MLV:sfv; + PTR:mail4.ucc.ie; MX:1; A:0; LANG:en; +X-OriginatorOrg: ucc.ie +X-Forefront-PRVS: 02243C58C6 +Received-SPF: Pass (: domain of ucc.ie designates 143.239.1.24 as permitted + sender) receiver=; client-ip=143.239.1.24; helo=mail4.ucc.ie; +Authentication-Results: spf=pass (sender IP is 143.239.1.24) + smtp.mailfrom=a.amann@ucc.ie; +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: Tue, 27 May 2014 08:50:42 -0000 + +Hi, + +I recently received some spam mails, which have a utf-16 byte order mark +(BOM) U+FEFF as the first character in one of their "Received:" +lines. When I run "notmuch new" I get the following: + +Note: Ignoring non-mail file: /home/user/Mail/new/path_to_email_with_BOM + +Could this be a bug in notmuch? Possible emails with BOM are not "legal" +anyhow, but in my opinion it would be better to simply ignore the BOM. + +I am using notmuch 0.18. + +Andreas + + + +P.S.: + +looking quickly at the code as a non-expert, it seems that the error +message comes from function "add_file" in "notmuch-new.c", because it +gets a status of "NOTMUCH_STATUS_FILE_NOT_EMAIL" from +"notmuch_database_add_message". This latter function is defined in +"lib/database.cc". It returns that status in the case, when +"notmuch_message_file_get_header" does not work (i.e. return NULL or "") +for the headers "from", "subject" or "to". In the message at hand all +of these headers only come after the BOM, so my guess is that +"notmuch_message_file_get_header" somehow chokes when it hits on the +BOM? + + + + + -- 2.26.2