wangp / bower

A curses terminal client for the Notmuch email system
Other
128 stars 11 forks source link

Mail showing weird timestamp for the past when sent from the future #53

Closed andir closed 4 years ago

andir commented 4 years ago

While trying out bower for the first time I encountered a strange mail in my Maildir:

$ notmuch show id:…
message{ id:… depth:0 match:1 excluded:0 filename:/…/1578693022.15388_28087.wrt,U=1470:2,

header{
redacted <redacted@gmail.com> (the future) (inbox signed unread)
Subject: …
From:redacted <redacted@gmail.com>
To: redacted
Date: Mon, 09 Dec 2058 10:53:39 +0200

header}

body{

part{ ID: 1, Content-type: multipart/signed

part{ ID: 2, Content-type: text/plain
…
part}

part{ ID: 3, Filename: signature.asc, Content-type: application/pgp-signature
Non-text part: application/pgp-signature

part}

part}

body}

message}

This mail contains a somewhat strange Date.. A few years from now in the future. When i look at it in bower it shows 1922-11-03 in the thread view but shows the "correct" date in the message view. My guess is that the message view shows the string as in the mail and the threaded view actually applies some parsing logic?

wangp commented 4 years ago

I guess you are running on a 32-bit platform.

The date in the thread view comes from the "timestamp" field in the notmuch search json output. The Unix time for "Mon, 09 Dec 2058 10:53:39 +0200" is 2806649619, which overflows a signed 32-bit integer to -1488317677, which corresponds to a date of "Fri Nov 3 12:25:23 AEST 1922". I'll fix it.

andir commented 4 years ago

I guess you are running on a 32-bit platform.

I am actually running on a 64bit platform.

$ file ./result/bin/bower
./result/bin/bower: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/y9zg6ryffgc5c9y67fcmfdkyyiivjzpj-glibc-2.27/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, stripped

Notmuch is also a 64bit executable.

wangp commented 4 years ago

I can reproduce it. notmuch search/show returns a negative timestamp.

wangp commented 4 years ago

This is fixed in notmuch 0.30 (for 64-bit platforms).