Re: [netmod] rfcstrip does not work on

Erik Auerswald <> Tue, 31 March 2020 12:01 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 5BE463A07BF for <>; Tue, 31 Mar 2020 05:01:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: 0.004
X-Spam-Status: No, score=0.004 tagged_above=-999 required=5 tests=[MAY_BE_FORGED=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id iATRq-g6fzj9 for <>; Tue, 31 Mar 2020 05:01:45 -0700 (PDT)
Received: from ( [IPv6:2001:638:208:120::220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 951AC3A07DF for <>; Tue, 31 Mar 2020 05:01:45 -0700 (PDT)
Received: from [] ( [] (may be forged)) (authenticated bits=0) by (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 02VC1RrF026120 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 31 Mar 2020 14:01:39 +0200
To: Carsten Bormann <>, Kent Watsen <>
Cc: =?UTF-8?Q?Bal=c3=a1zs_Lengyel?= <>, "" <>
References: <> <> <> <> <> <>
From: Erik Auerswald <>
Message-ID: <>
Date: Tue, 31 Mar 2020 14:01:26 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1
MIME-Version: 1.0
In-Reply-To: <>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 8bit
Archived-At: <>
Subject: Re: [netmod] rfcstrip does not work on
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 31 Mar 2020 12:01:47 -0000

Hi all,

On 31.03.20 09:36, Carsten Bormann wrote:
> On 2020-03-31, at 09:22, Carsten Bormann <> wrote:
>> On 2020-03-31, at 01:47, Kent Watsen <> wrote:
>>> I thought someone said that `xml2rfc` was going to support a “markers” attribute for the <sourcecode> element, but I don’t see that here yet:

Thanks for the additional info.  The proposal states:

     Proposal:  Add an attribute 'markers' for <sourcecode>, to control
        the emission of <CODE BEGINS> and <CODE ENDS>.  If markers="true"
        and the "name" attribute is set, the filename will also be
        emitted, as specified in [RFC8407] for YANG modules.

Thus the `file' part of the  <CODE ...> markers seems to be optional
there, too, unless the code in question is a YANG module.  In RFC8407 it
is recommended (SHOULD) to add a file name specification to the
<CODE BEGINS> marker, so it is still kind of optional.

I try to understand if the omission of a file name for the code in
draft-ietf-netmod-artwork-folding-12 was "wrong" or just "not great",
and what the current practice is.  It did result in Martin's `rfcstrip'
not extracting it from the text version.

Martin's `rfcstrip' could not extract `rfcfold' from the XML version
either,  because the XML uses `artwork' instead of `sourcecode'.
Adjusting the code to expect the `artwork' tag confirms this.  I used

     sed -i 's,//sourcecode\[,//artwork[,' rfcstrip

to try this out.  (Note that I do not suggest to apply this change to
Martin's `rfcstrip', but rather want to show what I did.)

> Oh, and you can find examples for markers=“true” in the published RFCs
> rfc8650.xml

RFC 8650 "Dynamic Subscription to YANG Events and Datastores over
RESTCONF" contains a YANG module inside a <CODE ...> section with
file name specification on the following line in the text rendering.

Since the code of Martin's `rfcstrip' that recognizes a <CODE ...>
section requires the keyword `file' on the same line as `<CODE BEGINS>',
I take a closer look at how it handles this RFC.

Martin's rfcstrip does not recognize this <CODE ...> section in the
text rendering, because the keyword `file' is not on the same line as
`<CODE BEGINS>'.  It still extracts the YANG module via the "type 3"
code path for YANG modules without <CODE ...> markers from the text

Martin's `rfcstrip' extracts the YANG module with the specified name
from the XML version of the RFC.  It extracts two of the many JSON
examples from the XML version as well.  The examples do not use
<CODE ...> markers in the text rendering.

One of the HTML renderings displays the file name on the same line
as the <CODE BEGINS> marker 
(, the 
other shows it on the
following line (, as does the
text rendering (  The PDF
rendering shows the file name specification on the same line as

As far as I understand it, the XML version of the RFC is authoritative
and tools are supposed to work on the XML, not renderings created from
XML.  [I am not sure about the exact RFC number where this change from
text to XML takes effect.]

> rfc8652.xml
> rfc8675.xml
> rfc8676.xml

The above RFCs contain YANG modules.  They specify file names for the
respective <CODE ...> sections.

> rfc8681.xml

RFC 8681 "Sliding Window Random Linear Code (RLC) Forward Erasure
Correction (FEC) Schemes for FECFRAME" does not contain a YANG module.
It contains C code.  It does not specify a file name for any of the
two code sections.

> rfc8682.xml

RFC 8682 "TinyMT32 Pseudorandom Number Generator (PRNG)" contains C code
inside a <CODE ...> section without specifying a file name.  The
preceding text does suggest a file name.

> rfc8695.xml

RFC 8695 is another YANG module RFC giving a file name for the
<CODE ...> section.

> rfc8696.xml

RFC 8696 "Using Pre-Shared Key (PSK) in the Cryptographic Message Syntax
(CMS)" contains an ASN.1 module inside a <CODE ...> section without file

> rfc8748.xml

RFC 8748 "Registry Fee Extension for the Extensible Provisioning
Protocol (EPP)" contains an XML schema inside <CODE ...> markers without
giving a file name.

It seems to me that <CODE BEGINS> ... <CODE ENDS> sections without file
name specification are common for both older RFCs in text format and
newer RFCs in XML format.  Even for YANG modules it seems to be
recommended, but not required, to specify a file name.  Thus I would not
have called the <CODE ...> line of draft-ietf-netmod-artwork-folding-12
"messed up," but do think that adding a file name improves it. :-)

The empty line after <CODE BEGINS> in I-D.ietf-netmod-artwork-folding-12
looks like a potential problem, because the first line of a shell script
on Unix-like systems needs to specify the interpreter, but Martin's
`rfcstrip' correctly handles this by skipping leading and trailing empty
lines inside the <CODE BEGINS> ... <CODE ENDS> section.

I think I do have a better understanding of the use of <CODE ...>
markers and the possible issues. :-)