RFR: 8349254: Disable "best-fit" mapping on Windows environment variables

Jaikiran Pai jpai at openjdk.org
Fri Feb 7 13:43:10 UTC 2025


On Thu, 6 Feb 2025 19:46:21 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> This is a follow-on fix to [JDK-8337506](https://bugs.openjdk.org/browse/JDK-8337506). The Java launcher can take arguments from "JDK_JAVA_OPTIONS" environment variable, so the same processing is needed. Also, obsolete code for Windows 9x has been removed.

src/java.base/share/native/libjli/args.c line 472:

> 470: JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name) {
> 471: #ifdef _WIN32
> 472:     char *env = winGetEnv(var_name);

I see that we are limiting this call to use `_wgetenv()` (the wide-character version of `getenv()`) only to `_WIN32`. Is there any harm in using `_wgetenv()` even for `_WIN64`? Or is the `getenv()` implementation on `_WIN64` not susceptible to the issues noted in the JBS?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23498#discussion_r1946542097


More information about the core-libs-dev mailing list