Subject: #1312 LInes: This may be tricky.... suggested resolution

From: Harald Alvestrand <[email-masked]>
Date: Wed, 26 Jul 2006 14:18:41 -0700

Ralph Babel wrote:
 >| 3.3.1. Lines
 >|
 >| The Lines header field indicates the number
 >| of lines in the body of the article.
 >|
 >| lines = "Lines:" SP *WSP 1*DIGIT *WSP CRLF
 >|
 >| The line count includes all body lines, including the
 >| signature if any, including empty lines (if any) at the
 >| beginning or end of the body, and including the whole of
 >| all MIME message and multipart parts contained in the body
 >| (the single empty separator line between the header fields
 >| and the body is not part of the body). The "body" here is
 >| the body as found in the posted article as transmitted by
 >| the user agent.
 >
 >Again, so many words ...
 >
 >For short: "the number of CRLF-separated
 ><*998text> productions in the <body>".

Unfortunately I don't think the two are equivalent - and my guess would 
be that Ralph's version is more likely to be true than the long 
versionm, but if you check out 2822 section 3.5, you'll find that the body

  One line of text<CRLF>

actually has two productions of *998text in it (the last being empty). 
But I think it has one line.

Suggested resolution:

Replace the last paragraph with:

   The line count is the number of CRLF separators in the body.

The whole field is obsolete anyway, so we shouldn't waste that many 
bytes on it.

Comments?

                    Harald

---

From: Russ Allbery <[email-masked]>
Date: Wed, 26 Jul 2006 14:29:42 -0700

> The whole field is obsolete anyway, so we shouldn't waste that many

Yup, sounds fine to me.  The language there currently stresses how the
field is formed, but in practice the field is formed a variety of
different ways (some of which are completely wrong) and one can't trust
that any particular algorithm is used.  Given that, I'd rather just say
the simplest possible thing about what the field is supposed to have and
let its deprecation stand as a comment on the weirdness of how it's
derived.

-- 
Russ Allbery ([email-masked])             <http://www.eyrie.org/~eagle/>

---

From: Frank Ellermann <[email-masked]>
Date: Fri, 28 Jul 2006 06:30:45 +0200

Harald Alvestrand wrote:

 [count CRLFs to get Lines]
> Comments?

+1

---

From: "Charles Lindsey" <[email-masked]>
Date: Fri, 28 Jul 2006 22:10:08 GMT

>   The line count is the number of CRLF separators in the body.

Yes, that would do. The main intent of the original wording was to
emphasise that it really did mean the _whole_ body, hence the mention of
the things that people might be tempted not to count. A lot of systems
have been known to get it wrong through such misunderstandings.

-- 
Charles H. Lindsey ---------At Home, doing my own thing------------------------
Tel: +44 161 436 6131 Fax: +44 161 436 6133   Web: http://www.cs.man.ac.uk/~chl
Email: [email-masked]      Snail: 5 Clerewood Ave, CHEADLE, SK8 3JU, U.K.
PGP: 2C15F1A9      Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5

---

From: "Charles Lindsey" <[email-masked]>
Date: Sun, 30 Jul 2006 19:01:48 GMT

>have been known to get it wrong through such misunderstandings.

On further thought, the usual mistake is to count the CRLF in the empty
line which separates the header fields from the body. Maybe that is worth
pointing out.

But at the very least, it needs s/body/<body>/ in Harald's text. That
makes it clear to anyone who takes the trouble to consult the RFC 2822
syntax.

---

From: Frank Ellermann <[email-masked]>
Date: Mon, 31 Jul 2006 00:19:16 +0200

Charles Lindsey wrote:
 
> the usual mistake is to count the CRLF in the empty
> line which separates the header fields from the body. Maybe
> that is worth pointing out.

| message         =       (fields / obs-fields)
|                         [CRLF body]
|
| body            =       *(*998text CRLF) *998text

We've removed the "MUST end with CRLF" to get in synch with
2822 some time ago.  That can result in an "off by two" error,
a short note about that effect is fine.

> it needs s/body/<body>/ in Harald's text.  That makes it
> clear to anyone who takes the trouble to consult the RFC 2822
> syntax.

Okay, then also add it to the import interface in section 1.4:

   body          = <see RFC2822 Section 3.5>

Bye, Frank

---

From: Harald Alvestrand <[email-masked]>
Date: Mon, 31 Jul 2006 10:44:43 +0200

> line which separates the header fields from the body. Maybe that is worth
Other common mistakes (from email) include counting bare LFs as 
linebreaks, representing multiple blank lines as CRLFLFLF and counting 
them all, breaking lines without adjusting the linecount, not counting a 
blank line at the end of a message, counting the line at the end of the 
message even when it's not CRLF-terminated, not including the blank 
lines around MIME boundaries.... I don't think you can usefully single 
out one common error. Agree that body needs to be <body>.