For reasons not completely understood at this time, gmime (as of 2.6.22) is returning a date before 1900 on bad date input. Since this confuses some other software, we clamp such dates to 0, i.e. 1970-01-01. --- lib/message.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 007f1171..8a8a25b4 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1034,10 +1034,15 @@ _notmuch_message_set_header_values (notmuch_message_t *message, /* GMime really doesn't want to see a NULL date, so protect its * sensibilities. */ - if (date == NULL || *date == '\0') + if (date == NULL || *date == '\0') { time_value = 0; - else + } else { time_value = g_mime_utils_header_decode_date (date, NULL); + /* + * Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=779923 + */ + time_value = (time_value < 0) ? 0 : time_value; + } message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP, Xapian::sortable_serialise (time_value)); -- 2.11.0