On Wed, Jan 28, 2026 at 11:32:57PM -0500, Kurt Hackenberg wrote:
I'm leery of making reading mbox configurable. This stuff is low-level, arcane, and dangerous -- could silently lose messages. Also, making it configurable at least doubles the amount of testing needed.
Yup. But if we want to fix #433, we either have to make the From line parser much looser for everyone and take that risk, or else make an option. My first take was is_from_reverse_scan(), making it looser for everyone. But then it seemed that either wasn't enough or was too much, depending on who you ask. :-D
Perhaps, without a configuration option:
if expect_from_line /* beginning of file, or after content-length */
turn on "From " prefix accepted mode
else if (has_mbox_sep) /* allow mangled return paths: #433 */
is_from_reverse_scan() /* as long as preceded by blank line */
else
is_from_forward_scan() /* the original from scanner */
/* note mutt never previously checked for a */
/* preceding blank line, so this isn't a */
/* change in behavior!! */
Does has_mbox_sep mean it found an empty line after the message? If so, I'd like a different name, maybe found_mbox_msg_terminator or something, to make it clear it's not the From_ line. (Also, there's an empty line after every message in the file, including the last, so it's technically not a separator.)
That's just an internal variable name, already in the code. :-D
has_mbox_sep = !mutt_strcmp (MBOX_SEP, buf);
where MBOX_SEP is "\n"
I've found Content-Length: (and Lines:) to be somewhat unreliable. When it's wrong, often it's just off by one line, but sometimes it's worse. (I have some statistics around here somewhere.) I suspect some of it is bugs, and some is when a message is modified but the lengths are not updated, because they're non-standard and not known by all software. I've seen them apparently not get updated by mailing list software that adds a footer to every message.Is Mutt a little skeptical about those lengths?
Yes. Mutt does a few checks on the length, including seek'ing and look for a "From " prefix, and checking to make sure it's not too big.
-- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
Description: PGP signature
