Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for static and dynamic analyzer tools.
https://codechecker.readthedocs.io
Apache License 2.0
2.28k stars 383 forks source link

Running diff for resolved issues and json output results in error #3910

Open geeksmith opened 1 year ago

geeksmith commented 1 year ago

Describe the bug When running 'CodeChecker cmd diff --resolved --output json ...' I get this stack trace:


[INFO 2023-05-15 11:19] - Given remote runs (--baseline): baseline-cap_a3_rn_h10_devel
[INFO 2023-05-15 11:19] - Checking local passwords or tokens in /tarana/homes/asmith/.codechecker.passwords.json
[INFO 2023-05-15 11:19] - Checking for local valid sessions.
[INFO 2023-05-15 11:19] - Logging in using pre-configured credentials...
[INFO 2023-05-15 11:19] - Authentication successful.
Traceback (most recent call last):
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_common/cli.py", line 209, in main
    sys.exit(args.func(args))
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_client/cmd/cmd.py", line 584, in __handle
    cmd_line_client.handle_diff_results(args)
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_client/cmd_line_client.py", line 1293, in handle_diff_results
    get_diff_remote_run_local_dir(
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_client/cmd_line_client.py", line 1025, in get_diff_remote_run_local_dir
    filtered_reports.extend(convert_report_data_to_report(results))
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_client/cmd_line_client.py", line 855, in convert_report_data_to_report
    source_line_contents = get_source_line_contents(reports_data)
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_client/cmd_line_client.py", line 835, in get_source_line_contents
    return client.getLinesInSourceFileContents(
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_client/thrift_call.py", line 45, in wrapper
    return func(*args, **kwargs)
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_api/codeCheckerDBAccess_v6/codeCheckerDBAccess.py", line 1130, in getLinesInSourceFileContents
    self.send_getLinesInSourceFileContents(linesInFilesRequested, encoding)
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_api/codeCheckerDBAccess_v6/codeCheckerDBAccess.py", line 1138, in send_getLinesInSourceFileContents
    args.write(self._oprot)
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_api/codeCheckerDBAccess_v6/codeCheckerDBAccess.py", line 7237, in write
    iter433.write(oprot)
  File "/tarana/homes/asmith/.local/lib/python3.8/site-packages/codechecker_api/codeCheckerDBAccess_v6/ttypes.py", line 3430, in write
    oprot.writeI64(iter222)
  File "/usr/local/lib/python3.8/dist-packages/thrift/protocol/TJSONProtocol.py", line 565, in writeI64
    checkIntegerLimits(i64, 64)
  File "/usr/local/lib/python3.8/dist-packages/thrift/protocol/TProtocol.py", line 415, in checkIntegerLimits
    elif bits == 64 and (i < -9223372036854775808 or i > 9223372036854775807):
TypeError: '<' not supported between instances of 'NoneType' and 'int'```

**CodeChecker version**
 6.21.0-rc (installed via pip)

**To Reproduce**
1. Run analysis on project and store results on server.
2. Cherry-pick new commit containing changes, possible fixes, possible new defects.
3. Run diff command to check for new issues: `CodeChecker cmd diff --new --uniqueing on --url https://<url> --basename baseline_devel --newname /<path>/ccreports --output json --export-dir /<path>/ccreports/ccdiff-resolved`
4. Run diff command to check for resolved issues: `CodeChecker cmd diff --resolved --uniqueing on --url https://<url> --basename baseline_devel --newname /<path>/ccreports --output json --export-dir /<path>/ccreports/ccdiff-resolved1`
5. Received error above.

**Expected behaviour**
 I expect a report of issues that were resolved in the cherry-picked change.

**Desktop (please complete the following information)**
 - Ubuntu Jammy 20.04
 - Browser: N/A
 - Version: N/A

**Additional context**
Seems like there's some entry either locally or in the remote database that has an empty value that CodeChecker isn't expecting.
geeksmith commented 1 year ago

Passing '--uniqueing off' avoids this error without any changes to source code.