From be2774dd81da77661511280fda868a02e4be87eb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 5 Nov 2018 15:25:59 +0200 Subject: Only search for external tools (compilers, linkers, etc) in PATH Specifically, omit the current executable's directory on Windows since there is no reason for them to be found there automagically and this can lead to surprising behavior (for example, our MinGW GCC being used instead of the user's even though the user's is in PATH before ours). --- build2/bin/guess.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'build2/bin') diff --git a/build2/bin/guess.cxx b/build2/bin/guess.cxx index ab7edf6..913736d 100644 --- a/build2/bin/guess.cxx +++ b/build2/bin/guess.cxx @@ -52,7 +52,10 @@ namespace build2 dr << info << "use config.bin.ar to override"; }); - arp = run_search (ar, true, fallback); + // Only search in PATH (specifically, omitting the current + // executable's directory on Windows). + // + arp = run_search (ar, true, fallback, true /* path_only */); } if (rl != nullptr) @@ -63,7 +66,7 @@ namespace build2 dr << info << "use config.bin.ranlib to override"; }); - rlp = run_search (*rl, true, fallback); + rlp = run_search (*rl, true, fallback, true /* path_only */); } // Binutils, LLVM, and FreeBSD ar/ranlib all recognize the --version @@ -269,7 +272,10 @@ namespace build2 dr << info << "use config.bin.ld to override"; }); - pp = run_search (ld, true, fallback); + // Only search in PATH (specifically, omitting the current + // executable's directory on Windows). + // + pp = run_search (ld, true, fallback, true /* path_only */); } // Binutils ld recognizes the --version option. Microsoft's link.exe @@ -397,7 +403,10 @@ namespace build2 dr << info << "use config.bin.rc to override"; }); - pp = run_search (rc, true, fallback); + // Only search in PATH (specifically, omitting the current + // executable's directory on Windows). + // + pp = run_search (rc, true, fallback, true /* path_only */); } // Binutils windres recognizes the --version option. -- cgit v1.1