Timestamp math causes uncaught exception
General informations
- system/distribution (with version): Debian sid (up to date as of 2021-09-15, relevant details below)
- offlineimap version (
offlineimap -V): "7.3.0" - Python version: 3.9
- server name or domain: fastmail.com
- CLI options: none
Configuration file offlineimaprc
[general]
metadata = ~/.local/share/offlineimap
accounts = Fastmail
[Account Fastmail]
localrepository = FastmailLocal
remoterepository = FastmailRemote
[Repository FastmailLocal]
type = Maildir
localfolders = ~/Mail
#sep = .
sync_deletes = yes
utime_from_header = yes
filename_use_mail_timestamp = no
[Repository FastmailRemote]
type = IMAP
remotehost = imap.fastmail.com
remoteport = 993
remoteuser = [email protected]
#auth_mechanisms = GSSAPI, XOAUTH2, CRAM-MD5, PLAIN, LOGIN
remotepassfile = ~/.config/offlineimap/fastmail_passwd.txt
# TODO: Agent this!
cert_fingerprint = AF:01:8E:7F:FF:36:61:06:C6:F9:D4:38:D1:4E:08:98:78:C8:27:C5:E5:C0:A3:97:49:37:F2:76:90:B1:27:59
maxconnections = 3
pythonfile (if any)
nope
Logs, error
OfflineIMAP 7.3.0
Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v3.05, Python v3.9.7, OpenSSL 1.1.1l 24 Aug 2021
Account sync Fastmail:
*** Processing account Fastmail
Establishing connection to imap.fastmail.com:993 (FastmailRemote)
Folder Archive [acc: Fastmail]:
Syncing Archive: IMAP -> Maildir
Folder Drafts [acc: Fastmail]:
Syncing Drafts: IMAP -> Maildir
Establishing connection to imap.fastmail.com:993 (FastmailRemote)
Folder fsme [acc: Fastmail]:
Syncing fsme: IMAP -> Maildir
Establishing connection to imap.fastmail.com:993 (FastmailRemote)
Folder INBOX [acc: Fastmail]:
Syncing INBOX: IMAP -> Maildir
Folder INBOX/blocksfree [acc: Fastmail]:
Syncing INBOX/blocksfree: IMAP -> Maildir
Folder INBOX/ghost1781 [acc: Fastmail]:
Syncing INBOX/ghost1781: IMAP -> Maildir
Folder INBOX [acc: Fastmail]:
Copy message UID 14901 (1/2) FastmailRemote:INBOX -> FastmailLocal:INBOX
Copy message UID 14902 (2/2) FastmailRemote:INBOX -> FastmailLocal:INBOX
Folder INBOX/hunter [acc: Fastmail]:
Syncing INBOX/hunter: IMAP -> Maildir
Folder INBOX/Gmail [acc: Fastmail]:
Syncing INBOX/Gmail: IMAP -> Maildir
Copy message from FastmailRemote:INBOX:
ERROR: Copying message 14901 [acc: Fastmail]
offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24), not datetime.timedelta(days=1, seconds=61200).
Thread 'Copy message from FastmailRemote:INBOX' terminated with exception:
Traceback (most recent call last):
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 413, in savemessage
date = self.get_message_date(msg, 'Date')
File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 748, in get_message_date
datetuple = parsedate_tz(msg.get(header))
File "/usr/lib/python3.9/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
File "/usr/lib/python3.9/email/policy.py", line 163, in header_fetch_parse
return self.header_factory(name, value)
File "/usr/lib/python3.9/email/headerregistry.py", line 601, in __call__
return self[name](name, value)
File "/usr/lib/python3.9/email/headerregistry.py", line 196, in __new__
cls.parse(value, kwds)
File "/usr/lib/python3.9/email/headerregistry.py", line 305, in parse
value = utils.parsedate_to_datetime(value)
File "/usr/lib/python3.9/email/utils.py", line 202, in parsedate_to_datetime
tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24), not datetime.timedelta(days=1, seconds=61200).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/share/offlineimap3/offlineimap/threadutil.py", line 146, in run
Thread.run(self)
File "/usr/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 815, in copymessageto
new_uid = dstfolder.savemessage(uid, message, flags, rtime)
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 421, in savemessage
datestr = self.get_message_date(msg)
File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 748, in get_message_date
datetuple = parsedate_tz(msg.get(header))
File "/usr/lib/python3.9/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
File "/usr/lib/python3.9/email/policy.py", line 163, in header_fetch_parse
return self.header_factory(name, value)
File "/usr/lib/python3.9/email/headerregistry.py", line 601, in __call__
return self[name](name, value)
File "/usr/lib/python3.9/email/headerregistry.py", line 196, in __new__
cls.parse(value, kwds)
File "/usr/lib/python3.9/email/headerregistry.py", line 305, in parse
value = utils.parsedate_to_datetime(value)
File "/usr/lib/python3.9/email/utils.py", line 202, in parsedate_to_datetime
tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24), not datetime.timedelta(days=1, seconds=61200).
Last 2 debug messages logged for Copy message from FastmailRemote:INBOX prior to exception:
thread: Register new thread 'Copy message from FastmailRemote:INBOX' (account 'Fastmail')
maildir: Write mail 'INBOX:14901' with flags set()
ERROR: Exceptions occurred during the run!
ERROR: Copying message 14901 [acc: Fastmail]
offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24), not datetime.timedelta(days=1, seconds=61200).
Traceback:
File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 815, in copymessageto
new_uid = dstfolder.savemessage(uid, message, flags, rtime)
File "/usr/share/offlineimap3/offlineimap/folder/Maildir.py", line 421, in savemessage
datestr = self.get_message_date(msg)
File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 748, in get_message_date
datetuple = parsedate_tz(msg.get(header))
File "/usr/lib/python3.9/email/message.py", line 471, in get
return self.policy.header_fetch_parse(k, v)
File "/usr/lib/python3.9/email/policy.py", line 163, in header_fetch_parse
return self.header_factory(name, value)
File "/usr/lib/python3.9/email/headerregistry.py", line 601, in __call__
return self[name](name, value)
File "/usr/lib/python3.9/email/headerregistry.py", line 196, in __new__
cls.parse(value, kwds)
File "/usr/lib/python3.9/email/headerregistry.py", line 305, in parse
value = utils.parsedate_to_datetime(value)
File "/usr/lib/python3.9/email/utils.py", line 202, in parsedate_to_datetime
tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
Steps to reproduce the error
-
- Run offlineimap
-
- There is no 2.
Debian details
Debian package version: 0.0~git20210825.4ca9c75+dfsg-1
-- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64)
Kernel: Linux 5.10.0-8-amd64 (SMP w/16 CPU threads) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE [Stupid proprietary wifi…] Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
Versions of packages offlineimap3 depends on: ii ca-certificates 20210119 ii python3 3.9.2-3 ii python3-distro 1.6.0-2 ii python3-imaplib2 2.57-5.2
offlineimap3 recommends no packages.
Versions of packages offlineimap3 suggests: ii python3-gssapi 1.6.12-1
-- no debconf information
Hello @iKarith
Thanks a lot for your report.
I think is an error parsing the Date field in the mail header. Do you have the email with problem? Could you check and send the header to us (only the Date field)?
There are many problems about that in other projects, for example: https://github.com/arrow-py/arrow/issues/354
Best Regards, kix