On Tue, 8 Apr 2025 19:50:43 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
> 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. This has passed Oracle internal CI testing for "builds-infra" tier 1-5. I have tried doing some manual adhoc testing, and it seems to work fine. The risk is that there is some odd environment out there where stuff might go wrong. I believe there should be no technical difference in how configure detects tools before and after this PR (with one exception: now for `make` it will look in TOOLSDIR before PATH. I think this is correct and what we should have done from the beginning, but it is a change). But it is impossible to find out about all such cases before integration. If someone runs into problems and come looking here: The short-term workaround is that any tool can be overridden with a complete path on the command line, so if e.g. `make` is incorrectly detected, you can run `bash configure MAKE=<path to your make>`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/24525#issuecomment-3270283531