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 in analyzer.py fails to locate diagtool.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.exe on Windows (sys.platform == 'win32')
- Look for
diagtool on 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
Bug Report: diagtool not found on Windows
Summary
On Windows systems, CodeChecker fails to find the
diagtoolbinary because it searches fordiagtoolinstead ofdiagtool.exe.CodeChecker version
To Reproduce
Steps to reproduce the behaviour:
get_diagtool_bin()function inanalyzer.pyfails to locatediagtool.exeRoot Cause
In
analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py, line 153:The code hardcodes the binary name as
diagtoolwithout considering the.exeextension required on Windows platforms.Expected Behaviour
The function should:
diagtool.exeon Windows (sys.platform == 'win32')diagtoolon Unix-like systemsdiagtool-14.exeAffected File
analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py-get_diagtool_bin()functionFix
The fix adds platform-specific binary name handling:
Desktop (please complete the following information)
Additional Context
sys.platform == 'win32'check is already used in other parts of the codebase for Windows-specific handling