FileSpec::Resolve used to use the realpath() POSIX API to fully qualify filenames. If realpath() was passed "ls" as an argument, if there was no "ls" in the current working directory, it would not change the argument.
The switch to llvm::sys::fs::make_absolute() changed this behavior. Now if you pass in "ls", make_absolute() will prepend the current working directory path and return that.
I can see the argument for make_absolute()'s behavior. If I were *creating* a file, so it didn't exist yet, then the make_absolute() behavior would be reasonable. But this isn't how lldb is using this -- we want to find a file that actually exists on the filesystem.
The failure mode for this is that a user does "lldb ls". Previously lldb would search through $PATH and find /bin/ls. Now when lldb creates a FileSpec for "ls", it resolves it into current-working-directory/ls which doesn't exist and it fails.
This is the second bug clearly tied to this change in behavior (see r222498 where I was fixing another one a couple months ago) - and it's a problematic landmine to leave in place given what lldb means when it says "Resolve" for a FileSpec.
Zachary, I'm not very familiar with the SmallVector/SmallString classes, this is probably not the best way to accomplish what I want to do here. What do you think?
You can write this like this:
llvm::SmallString<PATH_MAX> original_path(path.begin(), path.end());