#1053724 offlineimap3: OfflineIMAP crashes on synchronisation of a 'Message-ID: <>' in header

#1053724#5
Date:
2023-10-09 14:36:03 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   Using OfflineIMAP as a solution to synchronise and secure a second copies of messages.
   When a message contains a header line as
Message-ID: <>

   This causes a crash of the message header parsing of OfflineIMAP :

ERROR: Copying message 66358 [acc: XXXXXX]
  list index out of range
Thread 'Copy message from XXXXXX-remote:INBOX' terminated with exception:
Traceback (most recent call last):
  File "/usr/lib/python3.9/email/_header_value_parser.py", line 2069, in get_msg_id
    token, value = get_dot_atom_text(value)
  File "/usr/lib/python3.9/email/_header_value_parser.py", line 1334, in get_dot_atom_text
    raise errors.HeaderParseError("expected atom at a start of "
email.errors.HeaderParseError: expected atom at a start of dot-atom-text but found '>'

   This crash also inhibit OfflineIMAP from synchronising any message which is later in the IMAP list.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

   Currently, the only workaround is to suppress such messages from the originating mailbox.

   * What was the outcome of this action?

   The message is not archived (indeed, even worse : it is completely deleted), but the synchronisation can go on

   * What outcome did you expect instead?

   Both that the message is synchronised (as any other message) and the process continue to synchronise all the rest of the mailbox.

*** End of the template - remove these template lines ***