-
Notifications
You must be signed in to change notification settings - Fork 13
Fixed commands with paths passed as String to process execution #155
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
Conversation
" -j "+ getConfigValue(ConfigTypes.ANAL_THREADS) + " -n javarunner" + | ||
" -o "+ getConfigValue(ConfigTypes.CHECKER_WORKSPACE)+"/results/ " + buildLog; | ||
public String createAnalyzeCommmand(String buildLog) { | ||
return "'" + Utils.esc(codeCheckerCommand) + "'" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be easier to handle the command line options as a list of strings until the CommandLine type construction in the buildScriptCommandLine
There is a CommandLineParser which could be useful too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gyorb for the suggestion. This section was revised, and modified according to this https://commons.apache.org/proper/commons-exec/tutorial.html . The cli parser you mentioned was being used already but extended a bit.
* {@link https://unix.stackexchange.com/a/357932} | ||
*/ | ||
public static String esc(String path) { | ||
return path.replace("'", "'\\''"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some string escaping methods could we use them? Should we escape other characters too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section was replaced with the path substitution map.
d42645f
to
420316a
Compare
d768ace
to
09a0d9f
Compare
09a0d9f
to
3d15467
Compare
@@ -1,34 +1,42 @@ | |||
package org.codechecker.eclipse.plugin.runtime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A large part of modification is related to this class. Paths in Shell command scripts got misinterpreted before. This was corrected with the usage of String - File Command substitution maps.
@@ -3,15 +3,20 @@ | |||
import com.google.common.base.Optional; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other large part is in this class that actually makes the calls. Method signatures were changed to be able to use the command substitution maps.
...dechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/runtime/ShellExecutorHelper.java
Show resolved
Hide resolved
@@ -6,6 +6,17 @@ CodeChecker Stub used to emulate some CodeChecker commands for the tests. | |||
import sys | |||
import argparse | |||
|
|||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dummy Codechecker got a new functionality. Now it can return some checkers.
@@ -0,0 +1,97 @@ | |||
package org.codechecker.eclipse.plugin.runtime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests that the checkers are correctly returned.
@@ -1,16 +1,18 @@ | |||
package org.codechecker.eclipse.plugin.runtime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified because the method signatures were changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment only, otherwise LGTM.
...dechecker.eclipse.plugin/src/org/codechecker/eclipse/plugin/runtime/ShellExecutorHelper.java
Show resolved
Hide resolved
Modified every ShellExecutorHelper method signature. Now contains an optional substitution map for adding Paths as File for proper escaping. Extended test with test case that test Change directory into a directory with spaces. Added a test case that tests getting the checkers from various path sequences. Look in CodeCheckEnvironmentCheckerTest.java for more info. For this purpose, a CodeChecker stub was created that return some checkers. This Resides in the Unit test's resources folder. Current functionality only support getting the checkers.
3d15467
to
5861f7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Depends on #145.
Fixed commands with paths passed as String to process execution
Modified every ShellExecutorHelper method signature. Now contains an
optional substitution map for adding Paths as File for proper escaping.
Extended test with test case that test Change directory into a directory
with spaces.
Added a test case that tests getting the checkers from various path
sequences. Look in CodeCheckEnvironmentCheckerTest.java for more info.
For this purpose, a CodeChecker stub was created that return some
checkers. This Resides in the Unit test's resources folder. Current
functionality only support getting the checkers.
Resolves #147