This bug report was triggered by the discussion in https://github.com/openjdk/jdk/pull/21999.
In TOOLCHAIN_PRE_DETECTION, we prepend $TOOLCHAIN_PATH to the actual PATH, and then restore this in TOOLCHAIN_POST_DETECTION. This is likely a remnant of older times, before we started using our own UTIL_LOOKUP* functions. Instead, we should update UTIL_LOOKUP_TOOLCHAIN_PROGS to use $TOOLCHAIN_PATH:$PATH as 3rd variable to UTIL_LOOKUP_PROGS (if it is not given). The risk we need to be aware of is if some tool we're running assume that the TOOLCHAIN_PATH is properly included on the PATH, e.g. because it tries to execute a helper command in turn. This could specifically be a problem for Visual Studio, and we need to double-check that removing TOOLCHAIN_PATH from the PATH does not break anything. (In fact, I believe we already append TOOLCHAIN_PATH to the PATH specifically for Windows already, so this could very well be done twice...) With these changes in place, the hack introduced by [JDK-8343883](https://bugs.openjdk.org/browse/JDK-8343883) can be changed to a simple call to UTIL_LOOKUP_TOOLCHAIN_PROGS. ------------- Commit messages: - Merge branch 'master' into fix-toolchain-path - 8344030: Improved handling of TOOLCHAIN_PATH Changes: https://git.openjdk.org/jdk/pull/24525/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24525&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8344030 Stats: 69 lines in 6 files changed: 6 ins; 51 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/24525.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24525/head:pull/24525 PR: https://git.openjdk.org/jdk/pull/24525