Re: python-notmuch decoding error on a message
authorPatrick Totzke <patricktotzke@googlemail.com>
Fri, 25 Nov 2011 09:04:06 +0000 (09:04 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:23 +0000 (09:40 -0800)
25/fc07b6b226c33720b2a350e0ed7a613b71e9d4 [new file with mode: 0644]

diff --git a/25/fc07b6b226c33720b2a350e0ed7a613b71e9d4 b/25/fc07b6b226c33720b2a350e0ed7a613b71e9d4
new file mode 100644 (file)
index 0000000..11ec00f
--- /dev/null
@@ -0,0 +1,139 @@
+Return-Path: <patricktotzke@googlemail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id AAF1D431FD0\r
+       for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 01:05:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.7\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.7 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id aefDJ86tZvdY for <notmuch@notmuchmail.org>;\r
+       Fri, 25 Nov 2011 01:05:54 -0800 (PST)\r
+Received: from mail-vw0-f53.google.com (mail-vw0-f53.google.com\r
+       [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 00119431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 01:05:53 -0800 (PST)\r
+Received: by vbbff1 with SMTP id ff1so3450456vbb.26\r
+       for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 01:05:52 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=googlemail.com; s=gamma;\r
+       h=message-id:content-type:mime-version:content-transfer-encoding:to\r
+       :from:in-reply-to:references:subject:date;\r
+       bh=/NpNJq19Pwnrlk7qj0RoyBHOAx8qUZ+QWuXsT7xMq9U=;\r
+       b=A9PaD1Gx0nLjIyhSf5D8jfVthCLsd0YJaTXSvzX6PJX/NY1Q9gANQvSQ7YrJPXg7Mw\r
+       7n38OsmhM9czG+4zGNz287amk+RUmXQjSWRe/aeMSzJLuOmFTN1JijuXL3HVc95bZG5b\r
+       htA2wIEzAZ7684LSY1TSG3loN06sLFgAFEk5c=\r
+Received: by 10.52.22.170 with SMTP id e10mr32746421vdf.75.1322211952207;\r
+       Fri, 25 Nov 2011 01:05:52 -0800 (PST)\r
+Received: from localhost ([2001:6a0:5001:b:a288:b4ff:fe40:300c])\r
+       by mx.google.com with ESMTPS id eu4sm33387367vdc.8.2011.11.25.01.04.08\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 25 Nov 2011 01:05:51 -0800 (PST)\r
+Message-ID: <4ecf5a6f.84b8340a.1db5.045f@mx.google.com>\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+To: David Bremner <david@tethera.net>,\r
+       Antoine Amarilli <antoine.amarilli@ens.fr>, notmuch@notmuchmail.org\r
+From: Patrick Totzke <patricktotzke@googlemail.com>\r
+In-Reply-To: <8762i98pnh.fsf@zancas.localnet>\r
+References: <20111106221554.GA23240@clipper.ens.fr>\r
+       <8762i98pnh.fsf@zancas.localnet>\r
+Subject: =?utf-8?q?Re=3A_python-notmuch_decoding_error_on_a_message?=\r
+Date: Fri, 25 Nov 2011 09:04:06 +0000\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 25 Nov 2011 09:05:54 -0000\r
+\r
+Silly question: how do i get Antoine's msg stup into notmuch? i tried\r
+using pythons mailbox lib to add this string to one of my mailboxes, which =\r
+works fine.\r
+but upon `notmuch new` I get something along the lines of "skipped non-mail=\r
+ file $myfile"..\r
+\r
+back to the topic:\r
+I find it hichgly suprising that this decode fails because one can easily d=\r
+o sth like:\r
+\r
+```\r
+>>>'=3D?utf-8?B?M+ht?=3D =3D?utf-8?Q?e?=3D'.decode('UTF-8')\r
+u'=3D?utf-8?B?M+ht?=3D =3D?utf-8?Q?e?=3D'\r
+```\r
+So the actual string should not be the problem. Apparently,\r
+the string as its stored in the index is not plain ascii anymore, which it =\r
+was in the msg.\r
+I thought notmuch stores exacctly what it gets?\r
+\r
+Apart from this, I'd recommend replacing all decodes to unicode objects\r
+by a subroutine that does the following:\r
+If a global property notmuch.DEBUG is set to true: decode as is,\r
+which will raise these exceptions upon errors\r
+else: use .decode('UTF-8', errors=3D'ignore').\r
+\r
+In case the mail is not malformed, it will not contain any non-ascii symbol=\r
+s whatsoever,\r
+so both ways should work. If you happen to deal with a malformed mail, you'=\r
+d get\r
+the problematic symbols omitted (beware of this when doing cryptostuff).\r
+\r
+what do you think?\r
+/p\r
+\r
+\r
+Quoting David Bremner (2011-11-24 16:13:22)\r
+>On Sun, 6 Nov 2011 23:15:54 +0100, Antoine Amarilli <antoine.amarilli@ens.=\r
+fr> wrote:\r
+>> Hello,\r
+>> =\r
+\r
+>> The attached message makes python-notmuch crash when trying to access it=\r
+ (see\r
+>> attached log).\r
+>> =\r
+\r
+>> I don't know if the encoding of Subject is valid or not, but it would pr=\r
+obably\r
+>> be better anyway to ignore decoding errors and return some approximation=\r
+ of\r
+>> Subject instead of failing like this.\r
+>> =\r
+\r
+>\r
+>I get a set of critical errors about forgetting to call g_type_init.\r
+>\r
+>We actually call g_type_init in the CLI now, thanks to =\r
+\r
+>   =\r
+\r
+>   id:"1311625989-97755-1-git-send-email-aaronecay@gmail.com"\r
+>\r
+>but it sounds like this probably needs to be called either in libnotmuch\r
+>or in the bindings. =\r
+\r
+>\r
+>For what it is worth this message decodes fine in the CLI\r
+>\r
+>d\r
+>_______________________________________________\r
+>notmuch mailing list\r
+>notmuch@notmuchmail.org\r
+>http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r