Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Crash with intercept-build based compilation database #3685

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

bruntib
Copy link
Contributor

@bruntib bruntib commented Jun 17, 2022

When compilation database is generated by intercept build then a build
action in this JSON file contains "arguments" field instead of "command"
which is a list of command-line arguments instead of a single string.

CodeChecker supports only "command" field, so this transformation must
be done in "CodeChecker analyze" command in order to avoid failure
when building SkipHandler with "--file <header_file>" flag.

Fixes #3683

@bruntib bruntib added CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands bugfix 🔨 analyzer 📈 Related to the analyze commands (analysis driver) tu_collector 📃 The TU-collector analysis crash helper tool labels Jun 17, 2022
@bruntib bruntib added this to the release 6.20.0 milestone Jun 17, 2022
@bruntib bruntib requested a review from Szelethus June 17, 2022 15:59
@bruntib bruntib requested a review from vodorok as a code owner June 17, 2022 15:59
@bruntib bruntib changed the title [bugfix] Crash with intercep-build based compilation database [bugfix] Crash with intercept-build based compilation database Jun 17, 2022
@bruntib bruntib force-pushed the intercept_skip_file branch 5 times, most recently from 946640f to 9acc82c Compare June 21, 2022 09:27
@dkrupp dkrupp modified the milestones: release 6.20.0, release 6.21.0 Sep 8, 2022
@@ -851,6 +852,22 @@ def __get_result_source_files(metadata):
return result_src_files


def __transform_compile_commands(compile_commands):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With respect, you could've named this function process_compile_commands, reparse_compilation_database, adjust_compcoms, or simply function_234534_by_bruntib. :)

How about we call this change_args_to_command_in_comp_db or something more specific?

"""
In CodeChecker we support compilation databases where the JSON object of a
build action contains "file", "directory" and "command" fields. However,
compilation databases from intercept build are contan "arguments" instead
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
compilation databases from intercept build are contan "arguments" instead
compilation databases from intercept build are contain "arguments" instead

analyzer/tests/functional/skip/test_skip.py Show resolved Hide resolved
When compilation database is generated by intercept build then a build
action in this JSON file contains "arguments" field instead of "command"
which is a list of command-line arguments instead of a single string.

CodeChecker supports only "command" field, so this transformation must
be done in "CodeChecker analyze" command in order to avoid failure
when building SkipHandler with "--file <header_file>" flag.

Fixes Ericsson#3683
Copy link
Collaborator

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkrupp dkrupp merged commit 457b666 into Ericsson:master Nov 8, 2022
@bruntib bruntib deleted the intercept_skip_file branch November 9, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) bugfix 🔨 CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands tu_collector 📃 The TU-collector analysis crash helper tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CodeChecker finished with error: KeyError: 'command'
3 participants