Hello,
I just did a pull on main and I'm still getting the crash on mcalUart.c:
Bailing out from checking ..\Sources\mcal\mcalUart.c since there was an internal error: Failed to execute 'python "C:\Program Files\Cppcheck\addons/misra.py" --cli --rule-texts=../postbuild/cppcheck/misra_rules.txt --suppress-rules 17.8 "../Sources/mcal/mcalUart.c.dump" 2>&1'. Traceback (most recent call last):
File "C:\Program Files\Cppcheck\addons/misra.py", line 3350, in <module>
main()
File "C:\Program Files\Cppcheck\addons/misra.py", line 3294, in main
checker.parseDump(item)
File "C:\Program Files\Cppcheck\addons/misra.py", line 3128, in parseDump
self.executeCheck(905, self.misra_9_5, cfg, data.rawTokens)
File "C:\Program Files\Cppcheck\addons/misra.py", line 3074, in executeCheck
check_function(*args)
File "C:\Program Files\Cppcheck\addons/misra.py", line 1509, in misra_9_5
misra_9.misra_9_x(self, data, 905, rawTokens)
File "C:\Program Files\Cppcheck\addons\misra_9.py", line 402, in misra_9_x
ed = getElementDef(nameToken, rawTokens)
File "C:\Program Files\Cppcheck\addons\misra_9.py", line 417, in getElementDef
createArrayChildrenDefs(ed, nameToken.astParent, rawTokens)
File "C:\Program Files\Cppcheck\addons\misra_9.py", line 428, in createArrayChildrenDefs
foundToken = next(rawToken for rawToken in rawTokens if rawToken.file == token.file and rawToken.linenr == token.linenr and rawToken.column == token.column)
StopIteration</module>
I've attached the dump file and mcalUart.c for you.
I can't reproduce this with the dump file generated for your source with cppcheck from the main branch (commit b472b4e65da579ea00475f13be4daf5b28259c36).
But misra_9.py script fails on dump from your attachment. I'm not sure how did you get this dump, because it's very different from the mine. The size of my dump is about 30% less then yours. I'm not sure how can I reproduce this, so I can't reduce this problem to a single unit test.
Could you please update your cppcheck installation? I think this will solve the problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We've been trying to resolve this issue and looks like we're close. We were using cppcheck 1.9 before which was the initial issue. We've updated to 2.3 and noticed our install of python was being corrupted. I then reinstalled python (3.8.5) and now am getting the following error:
Checking ..\Sources\Events.c ...
Bailingoutfromchecking ..\Sources\Events.csincetherewasaninternalerror: Failedtoexecute'python "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=../postbuild/cppcheck/misra_rules.txt --suppress-rules 17.8 ..\Sources\Events.c.dump'. {"file": "Events.h", "linenr": 77, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 96, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 115, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 134, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 153, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 172, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 191, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
{"file": "Events.h", "linenr": 217, "column": 6, "severity": "style", "message": "Advisory. There should be no unused parameters in functions.", "addon": "misra", "errorId": "c2012-2.7", "extra": "Advisory"}
Traceback(mostrecentcalllast):
File"C:\Program Files\Cppcheck\addons\misra.py", line3591, in<module>main()File"C:\Program Files\Cppcheck\addons\misra.py", line3535, inmainchecker.parseDump(item)File"C:\Program Files\Cppcheck\addons\misra.py", line3367, inparseDumpself.executeCheck(902, self.misra_9_2, cfg)File"C:\Program Files\Cppcheck\addons\misra.py", line3317, inexecuteCheckcheck_function(*args)File"C:\Program Files\Cppcheck\addons\misra.py", line1742, inmisra_9_2checkArrayInitializer(eq.astOperand2, dimensions, valueType)File"C:\Program Files\Cppcheck\addons\misra.py", line1570, incheckArrayInitializerelements=getRecordElements(valueType)ifvalueType.type=='record'elseNoneAttributeError: 'NoneType'objecthasnoattribute'type'
I've attached the file and the .dump file for you also.
it looks like the addons folder wasn't replaced when I did the install of cppcheck 2.3. I uninstalled, and deleted the folder in program files and that resolved the issue.
Thank you,
Amir
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I was using cppcheck 1.90 and copied the latest addons folder from github and am getting the following errors on 2 files:
And
Hello, Amir,
Do these errors occur only on certain files?
It like the addon can't properly parse the raw tokens for the array definition. Could you please provide some minimal code examples?
Attached.
Last edit: Amir 2021-01-06
Thanks, I created this ticket: https://trac.cppcheck.net/ticket/10084
Hello,
I just did a pull on main and I'm still getting the crash on mcalUart.c:
Bailing out from checking ..\Sources\mcal\mcalUart.c since there was an internal error: Failed to execute 'python "C:\Program Files\Cppcheck\addons/misra.py" --cli --rule-texts=../postbuild/cppcheck/misra_rules.txt --suppress-rules 17.8 "../Sources/mcal/mcalUart.c.dump" 2>&1'. Traceback (most recent call last):
File "C:\Program Files\Cppcheck\addons/misra.py", line 3350, in <module>
main()
File "C:\Program Files\Cppcheck\addons/misra.py", line 3294, in main
checker.parseDump(item)
File "C:\Program Files\Cppcheck\addons/misra.py", line 3128, in parseDump
self.executeCheck(905, self.misra_9_5, cfg, data.rawTokens)
File "C:\Program Files\Cppcheck\addons/misra.py", line 3074, in executeCheck
check_function(*args)
File "C:\Program Files\Cppcheck\addons/misra.py", line 1509, in misra_9_5
misra_9.misra_9_x(self, data, 905, rawTokens)
File "C:\Program Files\Cppcheck\addons\misra_9.py", line 402, in misra_9_x
ed = getElementDef(nameToken, rawTokens)
File "C:\Program Files\Cppcheck\addons\misra_9.py", line 417, in getElementDef
createArrayChildrenDefs(ed, nameToken.astParent, rawTokens)
File "C:\Program Files\Cppcheck\addons\misra_9.py", line 428, in createArrayChildrenDefs
foundToken = next(rawToken for rawToken in rawTokens if rawToken.file == token.file and rawToken.linenr == token.linenr and rawToken.column == token.column)
StopIteration</module>
I can't reproduce this with the dump file generated for your source with cppcheck from the main branch (commit b472b4e65da579ea00475f13be4daf5b28259c36).
But misra_9.py script fails on dump from your attachment. I'm not sure how did you get this dump, because it's very different from the mine. The size of my dump is about 30% less then yours. I'm not sure how can I reproduce this, so I can't reduce this problem to a single unit test.
Could you please update your cppcheck installation? I think this will solve the problem.
Hi Georgiy,
We've been trying to resolve this issue and looks like we're close. We were using cppcheck 1.9 before which was the initial issue. We've updated to 2.3 and noticed our install of python was being corrupted. I then reinstalled python (3.8.5) and now am getting the following error:
I've attached the file and the .dump file for you also.
Last edit: Amir 2021-02-03
Hi, Amir,
I can't reproduce this error with latest master (0338e99f84bceaab75cf9dd321d3e85a2935b0d3). Everything works correctly.
Please, verify your Cppcheck installation.
To make sure that Cppcheck actually works, you can try call it from this docker container: https://hub.docker.com/r/jubnzv1/cppcheck . This is the latest version which updates automatically through github actions: https://github.com/jubnzv/cppcheck-docker .
Last edit: Georgiy Komarov 2021-02-04
it looks like the addons folder wasn't replaced when I did the install of cppcheck 2.3. I uninstalled, and deleted the folder in program files and that resolved the issue.
Thank you,
Amir