ietf-tools / rfclint

Perform Validation checks on Internet-Drafts
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

with bcp14 option, it crashes instead of giving useful output #1

Open alicerusso opened 2 years ago

alicerusso commented 2 years ago

When running rfclint -n --bcp14 --no-spell --no-xml --no-abnf --no-dup-detection (as a script called checkbcp14), it crashes when <bcp14> tags are missing, rather than giving output to point out the missing element.

Looks like a similar crash, whether the input contains a "MUST", "MUST NOT", "MAY" (or other keyword from BCP 14) that is missing the <bcp14>. Previously, it gave output such as:

file.xml:886: bcp14 text 'MAY' found without bcp14 tag around it

Sample input: https://www.rfc-editor.org/v3test/test9229.xml (missing tags around "MUST" on line 289)

% rfclint -n --bcp14 --no-spell --no-xml --no-abnf --no-dup-detection test9229.xml
Traceback (most recent call last):
  File "/usr/bin/rfclint", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/rfclint/run.py", line 355, in main
    lang2119.processTree(xmlrfc.tree.getroot())
  File "/usr/lib/python3.6/site-packages/rfclint/must.py", line 71, in processTree
    self.processTree(node)
  File "/usr/lib/python3.6/site-packages/rfclint/must.py", line 71, in processTree
    self.processTree(node)
  File "/usr/lib/python3.6/site-packages/rfclint/must.py", line 71, in processTree
    self.processTree(node)
  [Previous line repeated 2 more times]
  File "/usr/lib/python3.6/site-packages/rfclint/must.py", line 69, in processTree
    self.checkTree(tree)
  File "/usr/lib/python3.6/site-packages/rfclint/must.py", line 117, in checkTree
    self.checkTree(node)
  File "/usr/lib/python3.6/site-packages/rfclint/must.py", line 111, in checkTree
    xx = self.bcp14_re.finditer(tree.text)
TypeError: expected string or bytes-like object

Sample input: https://www.rfc-editor.org/v3test/test9143.xml (missing tags around "MUST NOT" on line 1720) yields same Traceback.

alicerusso commented 2 years ago

Another input file with the same issue (Traceback exactly as above): https://www.rfc-editor.org/v3test/test9200.xml

alicerusso commented 12 months ago

Another sample input (Traceback exactly as above): https://www.rfc-editor.org/v3test/test9484.xml

(Useful output would be about the missing tags around "MUST NOT" on line 1553.)