-
Notifications
You must be signed in to change notification settings - Fork 457
Open
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: ce5ed25)
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels