Only resolve cmd path against $PATH if path does not contain a folder.
BUG=chromium:773875
TEST=unit test
Change-Id: I442afcfac00bcdbdfa33b739087af12987c57584
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1772176
Tested-by: Tobias Bosch <tbosch@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
diff --git a/compiler_wrapper/compiler_wrapper.go b/compiler_wrapper/compiler_wrapper.go
index bbb7434..c394b76 100644
--- a/compiler_wrapper/compiler_wrapper.go
+++ b/compiler_wrapper/compiler_wrapper.go
@@ -14,7 +14,9 @@
func callCompiler(env env, cfg *config, inputCmd *command) int {
var compilerErr error
- if !filepath.IsAbs(inputCmd.Path) && !strings.HasPrefix(inputCmd.Path, ".") {
+
+ if !filepath.IsAbs(inputCmd.Path) && !strings.HasPrefix(inputCmd.Path, ".") &&
+ !strings.ContainsRune(inputCmd.Path, filepath.Separator) {
if resolvedPath, err := resolveAgainstPathEnv(env, inputCmd.Path); err == nil {
inputCmd = &command{
Path: resolvedPath,