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

Kesara Rathnayake <kesara@staff.ietf.org> Fri, 06 May 2022 19:57 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 41A0CC159499 for <xml2rfc@ietfa.amsl.com>; Fri, 6 May 2022 12:57:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.959
X-Spam-Level:
X-Spam-Status: No, score=-2.959 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, NICE_REPLY_A=-1.857, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=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 TCVCb8Q7AUwN for <xml2rfc@ietfa.amsl.com>; Fri, 6 May 2022 12:57:18 -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 E8004C159489 for <xml2rfc@ietf.org>; Fri, 6 May 2022 12:57:18 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by ietfx.amsl.com (Postfix) with ESMTP id AEDA543D73C4; Fri, 6 May 2022 12:57:18 -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 yeDM-0D87fxP; Fri, 6 May 2022 12:57:18 -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 328F743B01B7; Fri, 6 May 2022 12:57:18 -0700 (PDT)
Message-ID: <e702be26-8510-3c20-3897-6e38672ca26f@staff.ietf.org>
Date: Sat, 07 May 2022 07:57:16 +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>
Cc: xml2rfc Mailing List <xml2rfc@ietf.org>
References: <1340D948-3003-48B2-B62B-6B09FE1C479E@orandom.net> <079e6f33-9d51-038f-e48d-fc8eb35170bc@staff.ietf.org> <CB26F745-26AE-4F02-905F-3CE41BAB6C8D@orandom.net>
From: Kesara Rathnayake <kesara@staff.ietf.org>
Organization: IETF Administration LLC
In-Reply-To: <CB26F745-26AE-4F02-905F-3CE41BAB6C8D@orandom.net>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/xml2rfc/damZSWQoJQrnf3vNMZkhksjHhrI>
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 19:57:23 -0000


On 6/05/22 11:54 pm, David R. Oran wrote:
> 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.

Thanks for the information.
xml2rfc should emit an error in this instance without crashing.
I have created https://github.com/ietf-tools/xml2rfc/issues/769 to 
capture this issue.

  --Kesara
> 
>> 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

-- 
Kesara Rathnayake
Senior Software Development Engineer - IETF LLC
kesara@staff.ietf.org