Bug Report: diagtool not found on Windows
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
Research direction
The lookup is get_diagtool_bin() in analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py, which builds diagtool from the clang-tidy binary's parent directory around line 153. Read that function first, then check how sys.platform is handled elsewhere in the codebase. Done means that on win32 it finds diagtool.exe and the versioned diagtool-N.exe variant, while Unix lookup is unchanged.
Written by the indexing model from the issue text.
Description
Bug Report: diagtool not found on Windows
Summary
On Windows systems, CodeChecker fails to find the diagtool binary because it searches for diagtool instead of diagtool.exe.
CodeChecker version
- Current repository state (commit: ce5ed250)
To Reproduce
Steps to reproduce the behaviour:
- Install CodeChecker on Windows
- Run analysis with ClangTidy analyzer
- The
get_diagtool_bin()function inanalyzer.pyfails to locatediagtool.exe
Root Cause
In analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py, line 153:
diagtool_bin = clang_tidy_bin.parent / 'diagtool'
The code hardcodes the binary name as diagtool without considering the .exe extension required on Windows platforms.
Expected Behaviour
The function should:
- Look for
diagtool.exeon Windows (sys.platform == 'win32') - Look for
diagtoolon Unix-like systems - Similarly handle versioned binaries like
diagtool-14.exe
Affected File
analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py - get_diagtool_bin() function
Fix
The fix adds platform-specific binary name handling:
# Find diagtool next to the clang binary.
diagtool_name = 'diagtool.exe' if sys.platform == 'win32' else 'diagtool'
diagtool_bin = clang_tidy_bin.parent / diagtool_name
if diagtool_bin.exists():
return diagtool_bin
# Sometimes diagtool binary has a version number in its name: diagtool-14.
version = ClangTidy.get_binary_version()
if version:
versioned_name = f'diagtool-{version.major}'
if sys.platform == 'win32':
versioned_name += '.exe'
if diagtool_bin.with_name(versioned_name).exists():
return diagtool_bin.with_name(versioned_name)
Desktop (please complete the following information)
- OS: Windows 11 Pro
- Platform: win32
Additional Context
- This issue affects all Windows users using ClangTidy analyzer
- The same pattern should be checked for any other binary lookups in the codebase
- The
sys.platform == 'win32'check is already used in other parts of the codebase for Windows-specific handling
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 494
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from Ericsson/codechecker
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Ericsson/codechecker#5129 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Ericsson/codechecker#5110 ·
Maintainers usually reply within 1 day
-
analyzer :chart_with_upwards_trend: CLI :computer: discussion :bulb: enhancement :star2:
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Ericsson/codechecker#3836 · 2 comments ·
Maintainers usually reply within 1 day
-
CodeChecker 6.29+ ignores locale settings and forces UTF-8Possibly taken @ump45nose claimed this 12 days ago. Openbazel :jigsaw: bug :bug: CLI :computer: good first issue good to go :rocket: usability :+1:
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Ericsson/codechecker#5121 · 2 comments ·
Maintainers usually reply within 1 day
-
good to go :rocket:
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Ericsson/codechecker#5118 ·
Maintainers usually reply within 1 day
All issues in Ericsson/codechecker
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
onyx-dot-app/onyx#16016 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
black --check exits 0 and prints All done when a multi file run is interruptedPossibly taken @jiteshgulati claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
Non-positive worker counts wait for results without starting workersPossibly taken @IlyaKhalafi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day