RFR: 8346719: Add relaunchers to the static JDK image for missing executables [v9]
Alexey Semenyuk
asemenyuk at openjdk.org
Wed Sep 17 19:31:10 UTC 2025
On Wed, 17 Sep 2025 19:04:02 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> Passing arguments on Windows is tricky. We faced a similar challenge implementing shims in the Windows JDK installer. See [JDK-8266473](https://bugs.openjdk.org/browse/JDK-8266473), [JDK-8296383](https://bugs.openjdk.org/browse/JDK-8296383), and [JDK-8309489](https://bugs.openjdk.org/browse/JDK-8309489). All three CRs about the same issue until we finally fixed it properly.
>>
>> You need to encode command line args in a string suitable for passing to `CreateProcess()` function. The decoding algorithm is described at https://learn.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments?view=msvc-170&redirectedfrom=MSDN. You need to implement the reverse algorithm. It is not officially documented at MSDN. Fortunately, somebody contributed it to the blog post at https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way.
>
> Yes, I've read that blog post, tried to implement it and credited in the source code. :-)
>
> The discussion was if the executable name should be treated differently than the command line arguments. I've added code do explicitly do this, but I don't any longer recall why (this was originally developed back in like May or April, it's just been sitting on the shelf waiting for me to get to the finish line). I do recall that I ran into problems when I treated the executable name as any other argument though, so *something* special needs to be done about it.
>
> But reading this blog post again, it seems that it claims that the program name should be quoted the same way as well. I'll try to go back in time and check my notes, command line histories and old commits to see if I can figure out what kind of issue I ran into. Otherwise the correct solution seem to be to quote the program name the same way.
Oh, my bad :) I didn't dive into the source code. I came across this discussion and recalled a similar issue in the installer code.
We quote the program name in the installer shims.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24380#discussion_r2356541157
More information about the core-libs-dev
mailing list