Subject: Re: bin/3286: sendmail doesn't escape 'From'
To: None <netbsd-bugs@NetBSD.ORG>
From: Christoph Badura <bad@klicman.de>
List: netbsd-bugs
Date: 03/06/1997 23:43:21
Andrew Wheadon <andrew@wipux2.wifo.uni-mannheim.de> writes:
> > So how do these From_ lines get into the folder in the first place?
> Well elm just creates a header (maybe sendmail add's the correct From)
> and adds a line "Forwarded message:" and pastes the message (including
> an existing From line header and all) to it and feeds it into sendmail.

> One could argue that "elm" should be changed to escape the "From" line
> it pastes.

Uhm, elm _does_ escape the "From_" line.  It has for as long as I can
remember.  I just tested it (from a SunOS machine to NetBSD, where both
sendmails don't escape From_ lines.)

> Now the patch is useful to me, but it would still be more sensible
> to change mail.local or local.m4 since they are part of the standard
> distribution, so we make sure that every NetBSD machine gets it. As it
> is every person trying to port elm or any other mailer with the same
> idea of the mbox-format will have the trouble, will need a patch.

I wouldn't object to a patch to mail.local that escaped *valid* From_ 
lines in the body of messages only.  Currently, mail.local escapes only
lines starting with "From " after a blank line -- which is to broad already.
Your proposed patch makes it worse: escaping every line that starts with
"From ".

Anyway, this is the fist time in ten years that I hear about this problem.
And I've forwarded hundreds of messages during that time with elm.
Surely, if this were a widespread problem sendmail would include the E flag
on the local mailer by default by now.  And elm would have been fixed by now
too, I think.

> Why are we so certain that a mailer that considers any line beginning
> with "From " to be a new mail is faulty ? It is a perfectly good
> description of an mbox-format. It is very easy to implement.

Because it is a flawed description of the Unix mbox format.  There
needs to be an empty line before the From_ line and the From_ line
itself has to be in a certain format (described in the line you quoted
from realfrom.c.)

> PS2 I just checked and xbuffy-3.2.1 doesn't expect an empty line
> and wants the From line to look like this:
> realfrom.c:	From <user> <weekday> <month> <day> <hr:min:sec> [TZ1 [TZ2]] <y
ear> [rem...

Judging from the file name and the comment you picked out of the file, it
is derived from elm's lib/realfrom.c.  Please consider filing a bug with
the maintainers and forwarding my patch to them.