Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316609

Summary: Need to escape special characters in binary path
Product: [Tools] Linux Tools Reporter: Andrew Overholt <overholt>
Component: Call GraphAssignee: Roland Grunberg <rgrunber>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: charley.wang, pmuldoon
Version: unspecified   
Target Milestone: 1.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch for 316609 none

Description Andrew Overholt CLA 2010-06-11 09:48:16 EDT
I have a simple hello world C++ autotools project and the binary ends up having a "(GNU)" in its path.  It appears that we need to escape elements like parentheses in the generated shell script:

/tmp/org.eclipse.linuxtools.profiling.launch12762638928466417352370768374524.sh: line 2: syntax error near unexpected token `('
/tmp/org.eclipse.linuxtools.profiling.launch12762638928466417352370768374524.sh: line 2: `exec stap -o /tmp/testRC2/.metadata/.plugins/org.eclipse.linuxtools.callgraph.core/callgraph.out -c '/tmp/testRC2/AutotoolsProject/build-Build_(GNU)/src/a.out' /tmp/testRC2/.metadata/.plugins/org.eclipse.linuxtools.callgraph.core/callgraphGen.stp /tmp/testRC2/AutotoolsProject/build-Build_(GNU)/src/a.out'
Comment 1 Charley Wang CLA 2010-06-11 11:20:57 EDT
Created attachment 171735 [details]
Patch for 316609

Roland and I drafted a patch for this in Callgraph. Unfortunately we can't apply to Profiling directly, since Profiling doesn't distinguish between regular parameters and file paths. This quick fix just properly escapes (, ) and spaces in the binary and output paths.

Also, projects containing names with special characters currently don't seem to compile on CDT or AutoTools without manual tweaking, so I did this to reproduce:

1. Create C++ Autotools project named "test (316609)"
2. Rename cpp file to test316609.cpp
3. In Makefile, change the object file name to test316609

This allowed the CDT to finish building/compiling.
Comment 2 Alexander Kurtakov CLA 2012-04-19 03:46:22 EDT
Roland, Please review and apply or close the bug if it's not relevant anymore
Comment 3 Roland Grunberg CLA 2012-04-19 11:09:29 EDT
I've confirmed this fixes the issue and committed as f5ed5563795f387f22c25c3a1d3146569aa74c9f. The initial contribution was made to be specifically contributed to Callgraph under the EPL, by a former committer, and is < 250 loc. Resolving as fixed.