Re: [Mutt] #714: Lines starting From aren't escaped saving from Maildir to mbox
#714: Lines starting From aren't escaped saving from Maildir to mbox
Comment (by rtc):
Replying to [comment:18 vinc17]:
> Replying to [comment:17 rtc]:
> > From_ must be quoted in some way; if not, the end of the message
cannot be uniquely determined anymore.
> No, with some formats, it doesn't need to be quoted.
In fact, I only know exactly one mbox based format, the mboxcl format,
where this is the case. It has several severe flaws: Any reader that does
not know this sick convention will wreak havoc in such mailboxes; the
delivery program needs to take care of incoming mails that already have
Content-Length headers; if your delivery program doesn't (which is common,
you mentioned procmail, postfix and exim which don't take care of that, I
suppose), you get serious problems if you get a remote message with
tampered Content-Length headers etc. I fully agree with what the
aforementioned http://www.jwz.org/doc/content-length.html has to say about
that (despite its unfortunate rejection of mboxrdin favor of mboxo, which
is however done with much better arguments than your have here.)
> Also, if a line starting with "From" doesn't have the expected format,
it doesn't need to be quoted.
There is no such thing as "the expected format" of a "line starting with
'From'". If your mbox variety requires From_ quoting, you should quote any
line starting with "From ", and you should assume that any line starting
with "From " is a message separator. You complicate matters endlessly and
create many unnecessary new problems if you try to use such a seemingly
more "sophisticated" approach.
> Mutt does this check when reading a mailbox (if the Content-Length is
either incorrect or missing).
It shouldn't. If you ever have a message inside a mboxcl format mailbox
that lacks appropriate Content-Length, and it contains an unquoted From_,
something went horribly wrong.
> To write a message, they need to assume a format. For instance, if some
message contains a line starting with ">From ", it will have to be written
as ">From " in mboxo (this is what procmail, exim and postfix do), but it
will have to be written as ">>From " in mboxrd.
This is correct. However, your initial statement was "No, this is not the
format supported by most software" What is problematic about mboxrd not
being this format? Whether you choose to assume mboxo or mboxrd on a
mailbox written in the format supported by most software (that writes
mailboxes), and this format is mboxo, you will never in all cases be able
to unambiguously reconstruct the original message.
And one major MTA, qmail, has switched to mboxrd, so if you assume mboxrd,
you will at least have a clean solution for this case.
You are talking about the mboxcl format above. This is by far not the
format supported by most software, either.
> > Assuming mboxrd format when reading a mail from a mboxo format mailbox
has not more problems than assuming mboxo format when reading a mail from
a mboxo format mailbox.
> This is incorrect. Assuming that in general, a line starting with "From
" doesn't need to be quoted (see above), assuming mboxo format will lead
to fewer message "corruptions".
I don't understand what you mean. The first assumption cannot be combined
with the second. They contradict each other.
A From_ always needs to be quoted except if you assume mboxcl format, in
which case you need to assume mboxcl, not mboxo, on reading the mailbox,
and you are then trading the From_ problems for many other, much more
serious ones (see above).
Assuming mboxo format will never lead to fewer message corruptions
compared to assuming the mboxrd format. Of course you can always construct
specific examples where assuming the mboxrd format will corrupt the
message worse than assuming mboxo would. But these cases are very rare in
real world amd are never fatal.
> > > No information is lost when the mail is written. It is lost only
when the mail is stored to some mbox format.
> > In fact, it is only lost when the mail is stored to some mbox format
other than mboxrd.
> No (see above).
Information is lost in mboxcl format, too, because if you want to write a
mail in that format, you need to overwrite already existing Content-Length
headers, apart from the other problems I mentioned.
> > I am not exactly sure whether you have understood the problem that
mboxrd solves. mboxo mailboxes always involve a loss of information.
> No, this is wrong. If you have no lines starting with "From " (or if the
software is smart enough to detect that they don't need to be quoted, that
is, most of the time), there is no loss of information.
If I am talking about corruption, I am talking about what happens to the
infinity of possible messages, not any specific subset of them. If you
have no lines starting with "From ", you obviously never have problems.
Defining the problem to be non-existent is not a valid argument. I don't
see that "the software [being] smart enough to detect that they don't need
to be quoted" is in any way related to "most of the time".
--
Ticket URL: <http://dev.mutt.org/trac/ticket/714#comment:19>