Bug#593909: debian-policy: Clarifications about the syntax of Debian control files.
Charles Plessy <plessy@debian.org> writes:
> I was a bit afraid of receiving this answer. Actually, I made some
> research before proposing this wording, to better figure out what a
> “logical line” is. Unfortunately, there is not one single defintion. In
> some cases like the emacs [Visual Line mode][1], a logical line does not
> contain newline characters. But in some other cases like [Python][2], it
> does, as in the following example typed in the python interpreter:
RFC 5322 section 2.2.3 is probably the relevant definition for our
purposes:
2.2.3. Long Header Fields
Each header field is logically a single line of characters comprising
the field name, the colon, and the field body. For convenience
however, and to deal with the 998/78 character limitations per line,
the field body portion of a header field can be split into a
multiple-line representation; this is called "folding". The general
rule is that wherever this specification allows for folding white
space (not simply WSP characters), a CRLF may be inserted before any
WSP.
For example, the header field:
Subject: This is a test
can be represented as:
Subject: This
is a test
Note: Though structured field bodies are defined in such a way
that folding can take place between many of the lexical tokens
(and even within some of the lexical tokens), folding SHOULD be
limited to placing the CRLF at higher-level syntactic breaks. For
instance, if a field body is defined as comma-separated values, it
is recommended that folding occur after the comma separating the
structured items in preference to other places where the field
could be folded, even if it is allowed elsewhere.
The process of moving from this folded multiple-line representation
of a header field to its single line representation is called
"unfolding". Unfolding is accomplished by simply removing any CRLF
that is immediately followed by WSP. Each header field should be
treated in its unfolded form for further syntactic and semantic
evaluation. An unfolded header field has no length restriction and
therefore may be indeterminately long.
> The reason why I tried to fit the folded and multiline fields under the
> same definition of a logical line is that otherwise there was no
> definition of how to construct a multiline field. How about adding
> ‘Other lines are added following the same syntax as the continuation
> lines the folded fields.’ to your original wording:
> The value of a multiline field may consist of multiple lines.
> The first line of the value, the part on the same line as the
> field name, often has special significance or may have to be
> empty. Other lines are added following the same syntax as the
> continuation lines the folded fields. Whitespace, including
> newlines, is significant in the values of multiline fields.
Yup, that sounds great.
> Have a nice week-end,
You too!
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: