codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

Analyzer tries to list nonexistent directory in installation of 6.25.1 from PyPI on macOS

Open plexilcrf opened this issue 9 months ago • 2 comments

Describe the bug Installed CodeChecker via pip3. CodeChecker analyzer commands fail. See traceback in Additional Context.

The directory $CC_DATA_FILES_DIR/ld_logger/lib does not exist, so on every call to Context(), analyzer_context.Context.__init__() defaults to a fallback location, which also does not exist, attempts to get a directory list, and fails.

CodeChecker version PyPI package version 6.25.1 Python 3.12.9, installed from Homebrew

To Reproduce Steps to reproduce the behaviour:

  1. Install CodeChecker via pip3
  2. Type any CodeChecker command which requires analyzer contexts
  3. See error

Expected behaviour Version 6.24.4 of the PyPI package does not trigger this error; it works normally.

Desktop (please complete the following information)

  • Hardware: MacBook Pro 16" (2019) Intel
  • OS: [e.g. Linux] macOS Sonoma 14.7.4
  • Browser: [e.g. Firefox, Chrome] n/a
  • Version: [e.g. 22]

Additional context

Traceback of error follows.

Traceback (most recent call last):
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_common/cli.py", line 167, in main
    add_subcommand(subparsers, subcommand,
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_common/cli.py", line 57, in add_subcommand
    command_module.add_arguments_to_parser(sc_parser)
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_analyzer/cmd/analyze.py", line 511, in add_arguments_to_parser
    clang_has_z3 = analyzer_types.is_z3_capable()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_analyzer/analyzers/analyzer_types.py", line 78, in is_z3_capable
    enabled_analyzers, _ = check_supported_analyzers([ClangSA.ANALYZER_NAME])
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_analyzer/analyzers/analyzer_types.py", line 166, in check_supported_analyzers
    context = analyzer_context.get_context()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_analyzer/analyzer_context.py", line 393, in get_context
    return Context()
           ^^^^^^^^^
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_common/singleton.py", line 20, in __call__
    super(Singleton, cls).__call__(*args, **kwargs)
  File "/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_analyzer/analyzer_context.py", line 91, in __init__
    [str(arch) for arch in ld_logger_path.iterdir() if arch.is_dir()]
                           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cfry/homebrew/Cellar/[email protected]/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1056, in iterdir
    for name in os.listdir(self):
                ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/cfry/src/planner_test/tools/codechecker/cc_venv/lib/python3.12/site-packages/codechecker_analyzer/ld_logger/lib'

plexilcrf avatar Mar 27 '25 21:03 plexilcrf

Also occurs on Windows (simply ran CodeChecker).

Traceback (most recent call last):
  File "C:\Python313\Lib\site-packages\codechecker_common\cli.py", line 167, in main
    add_subcommand(subparsers, subcommand,
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
                   subcommands[subcommand], lib_dir_path)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\site-packages\codechecker_common\cli.py", line 57, in add_subcommand
    command_module.add_arguments_to_parser(sc_parser)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "C:\Python313\Lib\site-packages\codechecker_analyzer/cmd\analyze.py", line 511, in add_arguments_to_parser
    clang_has_z3 = analyzer_types.is_z3_capable()
  File "C:\Python313\Lib\site-packages\codechecker_analyzer\analyzers\analyzer_types.py", line 78, in is_z3_capable
    enabled_analyzers, _ = check_supported_analyzers([ClangSA.ANALYZER_NAME])
                           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\site-packages\codechecker_analyzer\analyzers\analyzer_types.py", line 166, in check_supported_analyzers
    context = analyzer_context.get_context()
  File "C:\Python313\Lib\site-packages\codechecker_analyzer\analyzer_context.py", line 393, in get_context
    return Context()
  File "C:\Python313\Lib\site-packages\codechecker_common\singleton.py", line 20, in __call__
    super(Singleton, cls).__call__(*args, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\site-packages\codechecker_analyzer\analyzer_context.py", line 91, in __init__
    [str(arch) for arch in ld_logger_path.iterdir() if arch.is_dir()]
                           ~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Python313\Lib\pathlib\_local.py", line 575, in iterdir
    with os.scandir(root_dir) as scandir_it:
         ~~~~~~~~~~^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Python313\\Lib\\site-packages\\codechecker_analyzer\\ld_logger\\lib'

VoltrexKeyva avatar Apr 05 '25 21:04 VoltrexKeyva

Also happening on Apple Silicon Mac when following the steps mentioned here

ravisumit33 avatar May 19 '25 13:05 ravisumit33