Re: [xml2rfc] Low priority bug - bad date input

"David R. Oran" <daveoran@orandom.net> Fri, 06 May 2022 11:54 UTC

Return-Path: <daveoran@orandom.net>
X-Original-To: xml2rfc@ietfa.amsl.com
Delivered-To: xml2rfc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B1145C157B4F for <xml2rfc@ietfa.amsl.com>; Fri, 6 May 2022 04:54:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.888
X-Spam-Level:
X-Spam-Status: No, score=-6.888 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZMVBSM-jFvZY for <xml2rfc@ietfa.amsl.com>; Fri, 6 May 2022 04:54:23 -0700 (PDT)
Received: from spark.crystalorb.net (spark.crystalorb.net [IPv6:2607:fca8:1530::c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8597FC157B4B for <xml2rfc@ietf.org>; Fri, 6 May 2022 04:54:23 -0700 (PDT)
Received: from [192.168.15.242] ([IPv6:2601:184:407f:80cf:2da1:4f7f:745b:daa4]) (authenticated bits=0) by spark.crystalorb.net (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id 246BsGSd025274 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Fri, 6 May 2022 04:54:18 -0700
From: "David R. Oran" <daveoran@orandom.net>
To: Kesara Rathnayake <kesara@staff.ietf.org>
Cc: xml2rfc Mailing List <xml2rfc@ietf.org>
Date: Fri, 06 May 2022 07:54:11 -0400
X-Mailer: MailMate (1.14r5895)
Message-ID: <CB26F745-26AE-4F02-905F-3CE41BAB6C8D@orandom.net>
In-Reply-To: <079e6f33-9d51-038f-e48d-fc8eb35170bc@staff.ietf.org>
References: <1340D948-3003-48B2-B62B-6B09FE1C479E@orandom.net> <079e6f33-9d51-038f-e48d-fc8eb35170bc@staff.ietf.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=_MailMate_022AB80B-151A-4E3C-A93D-F817E649767F_="
Archived-At: <https://mailarchive.ietf.org/arch/msg/xml2rfc/JTb0GxsyMxN7qib6NuxX1hfGES4>
Subject: Re: [xml2rfc] Low priority bug - bad date input
X-BeenThere: xml2rfc@ietf.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: XML2RFC discussion list <xml2rfc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/xml2rfc>, <mailto:xml2rfc-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/xml2rfc/>
List-Post: <mailto:xml2rfc@ietf.org>
List-Help: <mailto:xml2rfc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/xml2rfc>, <mailto:xml2rfc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 06 May 2022 11:54:28 -0000

On 5 May 2022, at 17:52, Kesara Rathnayake wrote:

> Hi Dave,
>
> Can you provide the xml2rfc version and draft that causes this error?
xml2rfc in /usr/local/lib/python3.9/site-packages (3.12.5)

> I can create an issue in https://github.com/ietf-tools/xml2rfc/issues/ for this.
>
> I grabbed https://www.ietf.org/id/draft-oran-icnrg-pathsteering-06.xml changed the year to 2016.
> And `xml2rfc --text --pdf --html draft-oran-icnrg-pathsteering-06.xml` gave me following error:
> ```
> Error: Expected <date> to have the current year when month is missing, but found '2016'
> ```
>
Strange - I can try to recreate.
It turns out the typo was “2016	“ (i.e. a tab in the year field that crashed xml2rfc)

I’ve attached the file.

> This is because xml2rfc has logic that checks for a month if the year is not the current year.
> There's an existing issue recorded for this to cover this to a warning [1].
>
> Cheers,
> Kesara
>
> [1] https://github.com/ietf-tools/xml2rfc/issues/704
>
> On 6/05/22 1:18 am, David R. Oran wrote:
>> I mistakenly typed the year “2016” into the date field for a draft update and it crashed xml2rfc rather than reporting an input error:
>>
>> oran@ORAN-M-51B7 icn-pathsteering % xml2rfc --text --pdf --html draft-oran-icnrg-pathsteering-06.xml
>> Traceback (most recent call last):
>>    File "/usr/local/bin/xml2rfc", line 8, in <module>
>>      sys.exit(main())
>>    File "/usr/local/lib/python3.9/site-packages/xml2rfc/run.py", line 739, in main
>>      xmlrfc.tree = prep.prep()
>>    File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/preptool.py", line 216, in prep
>>      tree = self.dispatch(self.selectors)
>>    File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/base.py", line 1925, in dispatch
>>      func(e, e.getparent())
>>    File "/usr/local/lib/python3.9/site-packages/xml2rfc/writers/preptool.py", line 419, in check_attribute_values
>>      if i and not i.isdigit() and not i==self.get_attribute_defaults(c.tag)[a]:
>> KeyError: 'year'
>> oran@ORAN-M-51B7 icn-pathsteering %
>>
>>DaveO
>>
>> _______________________________________________
>> xml2rfc mailing list
>> xml2rfc@ietf.org
>> https://www.ietf.org/mailman/listinfo/xml2rfc
>
> -- 
> Kesara Rathnayake
> Senior Software Development Engineer - IETF LLC
> kesara@staff.ietf.org
DaveO