[Lldb-commits] [lldb] r175135 - <rdar://problem/13200878>
gclayton at apple.com
Wed Feb 13 19:54:39 PST 2013
Date: Wed Feb 13 21:54:39 2013
New Revision: 175135
When launching in the shell, make sure if you specify a relative path, and if the current working directory has a space in it, that we don't hose the shell invocation.
Currently if we launch with a relative path, we prepend the current working directory to the PATH using:
PATH=`cwd`:$PATH a.out ...
We needed to add quotes around the value for PATH to make sure if any paths in PATH contained spaces, that we don't hose the shell command. Now we do a:
PATH="`cwd`:$PATH" a.out ...
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Feb 13 21:54:39 2013
@@ -515,7 +515,8 @@ ProcessLaunchInfo::ConvertArgumentsForLa
// We have a relative path to our executable which may not work if
// we just try to run "a.out" (without it being converted to "./a.out")
const char *working_dir = GetWorkingDirectory();
- std::string new_path("PATH=");
+ // Be sure to put quotes around PATH's value in case any paths have spaces...
+ std::string new_path("PATH=\"");
const size_t empty_path_len = new_path.size();
if (working_dir && working_dir)
@@ -536,7 +537,7 @@ ProcessLaunchInfo::ConvertArgumentsForLa
new_path += ':';
new_path += curr_path;
- new_path += ' ';
+ new_path += "\" ";
More information about the lldb-commits