Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@alicerusso

Description

@alicerusso

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions