python / cpython

The Python programming language
https://www.python.org
Other
62.37k stars 29.96k forks source link

mailbox fails to read message from mbox #90040

Open 46eb7d5d-5be2-4240-a641-f1c729c626c1 opened 2 years ago

46eb7d5d-5be2-4240-a641-f1c729c626c1 commented 2 years ago
BPO 45882

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['3.8', 'type-bug', 'library'] title = 'mailbox fails to read message from mbox' updated_at = user = 'https://bugs.python.org/peterwurmsdobler' ``` bugs.python.org fields: ```python activity = actor = 'peter.wurmsdobler' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'peter.wurmsdobler' dependencies = [] files = [] hgrepos = [] issue_num = 45882 keywords = [] message_count = 1.0 messages = ['406873'] nosy_count = 1.0 nosy_names = ['peter.wurmsdobler'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue45882' versions = ['Python 3.8'] ```

46eb7d5d-5be2-4240-a641-f1c729c626c1 commented 2 years ago

When using mailbox to convert mbox files to maildir, I have noticed that it cannot handle messages in the mbox file that start with two subsequent From lines in the header like:

From - Fri Feb 20 09:46:18 1998
>From namel@company.com Wed Feb 18 18:38:38 1998

A new maildir message will be created, but none of fields following the two header lines such as Date etc. will be parsed; the result is a message with header and body inside the message.

fsc-eriker commented 1 year ago

That is not really a valid mbox file in the first place.