CHeaderParser hangs forever if a line has both "{" and "}"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 102
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
The CHeaderParser script will hang forever searching for command parameters if a line has both a "{" and a "}". This includes commented lines since there is nothing in the script to ignore comment lines.
To Reproduce
- Add a comment such as /* {TEST_PARSER} */ to a header file
- Add that header file to CHeaderParser-hdr-paths.txt
Expected behavior
For one, the parser should ignore structs that are commented out so this line could be ignored entirely, but otherwise it should be adding that line to the list of command structs and continuing
Code snips
From CHeaderParser.py:
`
while inside_struct:
# Check for the end of the structure
# We will still want to know what line this is
if '}' in file_lines[line_num]:
# Clear the flag, we found the end.
inside_struct = False
# Add line number to list, even if it has a '}'
lines_of_struct.append(line_num)
# Now that we know the struct is over, add list of lines
# to the sets of command structures
list_cmd_structs.append(lines_of_struct)
line_num += 1
break
System observed on:
- OS: Ubuntu 20.0.4
- Versions: v3.3.0-rc4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in CHeaderParser.py, especially the while inside_struct loop that handles lines containing closing braces. Reproduce the hang with a header listed in CHeaderParser-hdr-paths.txt and a commented line containing both braces. Done means the parser continues instead of looping forever, while handling the reported command-struct line as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100