Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
https://codechecker.readthedocs.io
Apache License 2.0
2.23k stars 373 forks source link

Store fails when a source file referenced in a report is inside of a symlinked folder #4185

Closed vodorok closed 6 months ago

vodorok commented 6 months ago

When using CodeChecker 6.23.0, the following exception is thrown when CodeChecker checks a report source file which is beyond a symlinked folder.

Below is the (anonymized) relevant part of the trace:

 concurrent.futures.process._RemoteTraceback: 
 """
 Traceback (most recent call last):
   File "***/python3/lib/python3.9/concurrent/futures/process.py", line 243, in _process_worker
     r = call_item.fn(*call_item.args, **call_item.kwargs)
   File "***/python3/lib/python3.9/concurrent/futures/process.py", line 202, in _process_chunk
     return [fn(*args) for args in chunk]
   File "***/python3/lib/python3.9/concurrent/futures/process.py", line 202, in <listcomp>
     return [fn(*args) for args in chunk]
   File "***/codechecker_client/blame_info.py", line 43, in __get_blame_info
     if repo.ignored(file_path):
   File "***/git/repo/base.py", line 878, in ignored
     proc: str = self.git.check_ignore(*paths)
   File "***/git/cmd.py", line 739, in <lambda>
     return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
   File "***/git/cmd.py", line 1315, in _call_process
     return self.execute(call, **exec_kwargs)
   File "***/git/cmd.py", line 1110, in execute
     raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
 git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
   cmdline: git check-ignore /path/to/header.h
   stderr: 'fatal: pathspec '/path/to/header.h' is beyond a symbolic link'

Running analyze on proj reproduces the issue.

.
├── include
│   └── lib.h
└── proj
    ├── a.out
    ├── compile_commands.json
    ├── include -> ../include
    ├── main.c