-
Notifications
You must be signed in to change notification settings - Fork 188
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
Tern exits with 'killed' when Dockerfile RUN statement is complex #772
Comments
The issue is in
@ForgetMe17 Do you want to take a look? |
From what I can tell, get_shell_commands parser that @ForgetMe17 implemented is not the issue - it splits each of the commands correctly. Something happens while filtering out the "install" command. |
There are some problem with consolidate_commands():
We can assume two cases to point out the problems here:
Case 2
Case 1 is the cause of this issue. Case 2 only has affects on our output, not causing this issue. In general, this bug is caused by dead loop when we call A.merge(A), A is a Command object. |
I have fixed this by adjusting the logic in the consolidate_commands to fit the situations where there are more than one type of install commands. |
Fixed Tern exits with 'killed' when Dockerfile RUN statement is complex. Changed logic in the function consolidate_commands() in tern/analyze/common.py. Fixes tern-tools#772. Signed-off-by: WangJL <hazard15020@gmail.com>
Fixed Tern exits with 'killed' when Dockerfile RUN statement is complex. Changed logic in the function consolidate_commands() in tern/analyze/common.py. Fixes tern-tools#772. Signed-off-by: WangJL <hazard15020@gmail.com>
Fixed Tern exits with 'killed' when Dockerfile RUN statement is complex. Changed logic in the function consolidate_commands() in tern/analyze/common.py. Fixes tern-tools#772. Signed-off-by: WangJL <hazard15020@gmail.com>
@rnjudge Thanks for finding out this bug! |
Thanks for taking a look and finding the fix so quickly! |
Fixed Tern exits with 'killed' when Dockerfile RUN statement is complex. Changed logic in the function consolidate_commands() in tern/analyze/common.py. Fixes #772. Signed-off-by: WangJL <hazard15020@gmail.com>
Describe the bug
Running Tern on a Dockerfile with a complex RUN statement causes it to crash.
To Reproduce
Steps to reproduce the behavior:
tern report -d Dockerfile
Tern builds the image correctly but fails during the analysis. I noticed it lists "No listing statement" for all the non-snippet install commands that come right after each
&&
(echo, wget, apt-key, rm) and then gets killed.Error in terminal
Expected behavior
Tern should generate a report for the Dockerfile.
Environment you are running Tern on
Enter all that apply
The text was updated successfully, but these errors were encountered: