On Tue, Oct 7, 2025 at 11:09 AM Alan Bateman <[email protected]> wrote: > > > > On 07/10/2025 16:15, Benjamin Peterson wrote: > > I've had a PR for the native library loading code up for a months that > I'd appreciate any review on: > https://github.com/openjdk/jdk/pull/24694 > > To summarize the issue and proposed fix: Before OpenJDK 24, > System.loadLibrary on Windows passed symbolic links unresolved to the > underlying LoadLibrary function. JDK-8003887 caused symbolic links to > be resolved by Java before the system LoadLibrary function. > Unfortunately, LoadLibrary is clever and may mangle the filename > passed to it, which means passing a symlink may not have the same > behavior as presenting the fully resolved path. I propose to fix this > problem in the PR by disabling LoadLibrary's clever mangling behavior. > > The reason this didn't come to a conclusion is because this isn't really a > JDK bug, instead it's a about a strange environment where some "mystery > product" has moved the DLLs out the JDK run-time image directory and put them > somewhere without the .dll suffix. The JDK expects the DLLs to be in the bin > directory and named ".dll". So it's really a question as to whether the JDK > should accept a change to allow this strange setup.
The reproducer I submitted in the initial bug report is definitely weird looking because I attempted point out the breaking change in as simple and as self-contained a manner as possible. But, I did run into this in a very real and useful application. I've tried to add more context about the application in comments such as https://bugs.openjdk.org/browse/JDK-8348828?focusedId=14744766&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14744766. I can certainly answer more questions about the usecase if the would be helpful. The heart of the matter is: Is it legal to call System.loadLibrary() with a symlink on Windows? The JDK before 24's answer was yes.
