You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mailbox._mboxMMDF.get_message throws away From envelope #75705
I believe that setting the file back to the start is probably the best solution.
The message as provided by e.g. postfix will include the From header and the parser is able to deal with that successfully, so I'm not sure why the mbox reader removes it before calling the parser. It only really needs to drop the trailing newline to ensure that the parser gets the same data.
It just needs to call set_unixfrom as well as set_from. I don't know why the MMDFMessage tracks it separately, but I'm sure the author had a reason that seemed good at the time :)
Activity
bpoaugust commentedon Sep 19, 2017
https://github.com/python/cpython/blob/master/Lib/mailbox.py#L778
The code here reads the first line, but fails to save it as the unixfrom line.
Alternatively perhaps it should reset the file back to the start so the message factory has sight of the envelope.
The end result is that the envelope is lost.
bitdancer commentedon Sep 20, 2017
It looks like it is saving it (the set_from line). Do you have a test that proves otherwise?
bpoaugust commentedon Sep 20, 2017
It is not saving the unix from line.
#!/usr/bin/env python3
bpoaugust commentedon Sep 20, 2017
I believe that setting the file back to the start is probably the best solution.
The message as provided by e.g. postfix will include the From header and the parser is able to deal with that successfully, so I'm not sure why the mbox reader removes it before calling the parser. It only really needs to drop the trailing newline to ensure that the parser gets the same data.
bitdancer commentedon Sep 20, 2017
It just needs to call set_unixfrom as well as set_from. I don't know why the MMDFMessage tracks it separately, but I'm sure the author had a reason that seemed good at the time :)
#gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-107117)
GH-pythongh-75705: Set unixfrom envelope in mailbox._mboxMMDF (python…
GH-pythongh-75705: Set unixfrom envelope in mailbox._mboxMMDF (python…
[3.12] GH-gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-10…
[3.11] GH-gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-10…
#pythongh-75705: Set unixfrom envelope in mailbox._mboxMMDF (pythonGH…