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

Kesara Rathnayake <kesara@staff.ietf.org> Thu, 05 May 2022 21:52 UTC

Return-Path: <kesara@staff.ietf.org>
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 7C706C1594AD for <xml2rfc@ietfa.amsl.com>; Thu, 5 May 2022 14:52:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.963
X-Spam-Level:
X-Spam-Status: No, score=-7.963 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, NICE_REPLY_A=-1.857, RCVD_IN_DNSWL_HI=-5, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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 2Pst7svVpZlY for <xml2rfc@ietfa.amsl.com>; Thu, 5 May 2022 14:52:13 -0700 (PDT)
Received: from ietfx.amsl.com (unknown [50.223.129.196]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2C345C1594A0 for <xml2rfc@ietf.org>; Thu, 5 May 2022 14:52:13 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by ietfx.amsl.com (Postfix) with ESMTP id 210EC4050F99; Thu, 5 May 2022 14:52:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
Received: from ietfx.amsl.com ([50.223.129.196]) by localhost (ietfx.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VK14PBbwO7b1; Thu, 5 May 2022 14:52:13 -0700 (PDT)
Received: from [192.168.1.87] (122-58-104-37-adsl.sparkbb.co.nz [122.58.104.37]) by ietfx.amsl.com (Postfix) with ESMTPSA id 983344050F98; Thu, 5 May 2022 14:52:12 -0700 (PDT)
Message-ID: <079e6f33-9d51-038f-e48d-fc8eb35170bc@staff.ietf.org>
Date: Fri, 06 May 2022 09:52:10 +1200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Thunderbird/100.0
Content-Language: en-NZ
To: "David R. Oran" <daveoran@orandom.net>, xml2rfc Mailing List <xml2rfc@ietf.org>
References: <1340D948-3003-48B2-B62B-6B09FE1C479E@orandom.net>
From: Kesara Rathnayake <kesara@staff.ietf.org>
Organization: IETF Administration LLC
In-Reply-To: <1340D948-3003-48B2-B62B-6B09FE1C479E@orandom.net>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/xml2rfc/w5omMT8ejd_2wVmZmQnL12_XMo8>
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: Thu, 05 May 2022 21:52:17 -0000

Hi Dave,

Can you provide the xml2rfc version and draft that causes this error?
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'
```

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