summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCharley Wang2012-04-19 10:59:55 (EDT)
committer Roland Grunberg2012-04-19 11:08:03 (EDT)
commitf5ed5563795f387f22c25c3a1d3146569aa74c9f (patch)
tree25fab4c7b4486111a56e6394420f6b9628d11128
parenta704788cb8814fe65473be272be963c187359cf3 (diff)
downloadorg.eclipse.linuxtools-f5ed5563795f387f22c25c3a1d3146569aa74c9f.zip
org.eclipse.linuxtools-f5ed5563795f387f22c25c3a1d3146569aa74c9f.tar.gz
org.eclipse.linuxtools-f5ed5563795f387f22c25c3a1d3146569aa74c9f.tar.bz2
Fix BZ #316609.
Re-apply patch supplied in corresponding bug. Callgraph should properly execute a binary even with some special characters in the output, or binary path.
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java1
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java1
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java18
3 files changed, 20 insertions, 0 deletions
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java
index 90f7cb7..01e5d91 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java
@@ -76,6 +76,7 @@ public class LaunchStapGraph extends SystemTapLaunchShortcut {
if (wc == null)
wc = createConfiguration(bin, name);
binaryPath = bin.getResource().getLocation().toString();
+ binaryPath = escapeSpecialCharacters(binaryPath);
arguments = binaryPath;
outputPath = PluginConstants.getDefaultIOPath();
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java
index 04827b0..af10c86 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchWizard.java
@@ -248,6 +248,7 @@ public class LaunchWizard extends SystemTapLaunchShortcut {
public void widgetSelected(SelectionEvent e) {
scriptPath = scriptLocation.getText();
binaryPath = binaryLocation.getText();
+ binaryPath = escapeSpecialCharacters(binaryPath);
arguments = argumentsLocation.getText();
ILaunchConfigurationWorkingCopy wc = createConfiguration(null, name);
try {
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
index ec8c7b0..7fe90d3 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
@@ -129,6 +129,7 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
private Button OKButton;
private boolean testMode = false;
protected String secondaryID = ""; //$NON-NLS-1$
+ private final String [] escapableChars = new String [] {"(", ")", " "}; //$NON-NLS-1$
/**
* Provides access to the Profiling Frameworks' launch method
@@ -239,6 +240,7 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
if (!invalid(binaryPath))
wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH,binaryPath);
+ outputPath = escapeSpecialCharacters(outputPath);
wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,outputPath);
wc.setAttribute(LaunchConfigurationConstants.ARGUMENTS, arguments);
wc.setAttribute(LaunchConfigurationConstants.GENERATED_SCRIPT,generatedScript);
@@ -934,6 +936,7 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
ILaunchConfigurationWorkingCopy wc = createConfiguration(bin, name);
binaryPath = bin.getResource().getLocation().toString();
+ binaryPath = escapeSpecialCharacters(binaryPath);
arguments = binaryPath;
outputPath = PluginConstants.getDefaultIOPath();
finishLaunch(name, mode, wc);
@@ -972,4 +975,19 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
public String setSecondaryViewID() {
return ""; //$NON-NLS-1$
}
+
+ /**
+ * Escapes special characters in the target string
+ *
+ * @param script the script to be executed by the shell.
+ * @return the formatted string that will be executed.
+ */
+ protected String escapeSpecialCharacters(String str) {
+ // Modify script to catch escapable characters.
+ String res = str;
+ for (int i = 0; i < escapableChars.length; i++) {
+ res = res.replace(escapableChars[i], "\\" + escapableChars[i]); //$NON-NLS-1$
+ }
+ return res;
+ }
}