On Thu, 28 May 2026 20:13:37 GMT, Ashay Rane <[email protected]> wrote:

>> Although the original implementation of `JLI_Open()` borrowed from the
>> code in src/hotspot/os/windows/os_windows.cpp, the improvements to
>> os_windows.cpp don't seem to have been applied to java_md.c, causing
>> some tests to fail when the path to JAR files is longer than `MAXPATH`
>> (i.e. 260) characters on Windows (see associated JBS issue 8385024 for
>> details).  Since `JLI_Open()` is not just invoked inside tests, this is
>> not a test-specific issue, so fixing the test is not the right solution.
>> 
>> This patch applies the recent changes from os_windows.cpp to java_md.c
>> so that `JLI_Open()` can correctly handle longer than `MAXPATH` paths.
>> The new code is almost the same as that in `wide_abs_unc_path()` in
>> os_windows.cpp, except that the code in java_md.c uses `JLI_MemAlloc()`
>> and `JLI_MemFree()` for memory allocation and deallocation.
>> 
>> Although it would be ideal to have just one implementation between
>> HotSpot and the launcher, the dependencies of the two components
>> prevents us from having a single implementation.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Ashay Rane has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove statement that I had inserted for debugging

I did another pass over this. You'll addressed all my comments and startup 
benchmarks are looking okay. It's just a shame that the launcher needs to carry 
all this code for the sake of the SplashScreen-Image attribute (when headful) 
and -javaagent.

The updated test is good, just a few minor comments and the copyright header 
will need to be updated.

test/jdk/tools/launcher/Arrrghs.java line 511:

> 509:      */
> 510: 
> 511:     @Test

The `@bug tag on this test has been accumulating the list of bug IDs of issues 
that extended the test. So we can add 8385024 to that list.

test/jdk/tools/launcher/Arrrghs.java line 520:

> 518:         String jarName = "elp.jar";
> 519:         String dirSegment = "longpathtest_longpathtest/";
> 520:         int cwdLen = 
> Path.of(".").toAbsolutePath().normalize().toString().length();

Just FYI that you can reduce `Path.of(".").toAbsolutePath().normalize()` to 
`Path.of("").toAbsolutePath()` or use the value of the user.dir property, all 
will work.

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

PR Review: https://git.openjdk.org/jdk/pull/31209#pullrequestreview-4390419055
PR Review Comment: https://git.openjdk.org/jdk/pull/31209#discussion_r3325028993
PR Review Comment: https://git.openjdk.org/jdk/pull/31209#discussion_r3325022726

Reply via email to