Bug 241317 - java/openjdk8: unsatisfied link of getmntonname0
Summary: java/openjdk8: unsatisfied link of getmntonname0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Greg Lewis
Keywords: easy, patch, patch-ready
Depends on:
Reported: 2019-10-17 20:45 UTC by Christoph Moench-Tegeder
Modified: 2019-10-17 22:41 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (java)

make BsdNativeDispatcher actoally load the native library to dispatch to (517 bytes, patch)
2019-10-17 20:45 UTC, Christoph Moench-Tegeder
no flags Details | Diff
have BsdNativeDispatcher load it's library and make that library export it's symbols (3.08 KB, patch)
2019-10-17 21:55 UTC, Christoph Moench-Tegeder
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Moench-Tegeder freebsd_committer 2019-10-17 20:45:21 UTC
Created attachment 208391 [details]
make BsdNativeDispatcher actoally load the native library to dispatch to

Since the latest update of openjdk8 (openjdk8- german/mediathekview broke: clicking on a download button gives no reaction in the GUI and an exception like this (shortened to the relevant part, because java):

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: sun.nio.fs.BsdNativeDispatcher.getmntonname0(J)[B
        at sun.nio.fs.BsdNativeDispatcher.getmntonname0(Native Method)
        at sun.nio.fs.BsdNativeDispatcher.getmntonname(BsdNativeDispatcher.java:61)
        at sun.nio.fs.BsdFileStore.findMountEntry(BsdFileStore.java:67)
        at sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:65)
        at sun.nio.fs.BsdFileStore.<init>(BsdFileStore.java:40)
        at sun.nio.fs.BsdFileSystemProvider.getFileStore(BsdFileSystemProvider.java:55)
        at sun.nio.fs.BsdFileSystemProvider.getFileStore(BsdFileSystemProvider.java:39)
        at sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:368)
        at java.nio.file.Files.getFileStore(Files.java:1461)
        at mediathek.gui.dialog.DialogAddDownload.getFreeDiskSpace(DialogAddDownload.java:268)

Poking around jdk/src/solaris/classes/sun/nio/fs/BsdNativeDispatcher.java it appears that indeed getmntonname0() is declared "native", but there are no provisions to load a suitable library for that method. The other NativeDispatchers call System.loadLibrary("nio"), which would make a lot of sense here, too - a "NativeDispatcher" should at least have some access to the library it is dispatching to.

Attached is a patch (to be dropped into files/) which implements the same System.loadLibrary() logic with it's wrappers in BsdNativeDispatcher.java. This still passes poudriere and fixes mediathekview for me. I've not reported this upstream, as I'm not even sure which upstream to report to (and I'd dread to go through the submit-a-trivial-patch dance with the-company-which-swallowed-Sun).

I'm debugging a JDK - what am I doing with my live?
Comment 1 Christoph Moench-Tegeder freebsd_committer 2019-10-17 21:55:21 UTC
Created attachment 208392 [details]
have BsdNativeDispatcher load it's library and make that library export it's symbols

That didn't go too well - that new getmntonname0() has to be exported by the library (I had forgotten about the first half of the fix by the time I finished the second part, duh).

This comes as a patch to be applied, not dropped into files.
Comment 2 commit-hook freebsd_committer 2019-10-17 22:39:54 UTC
A commit references this bug:

Author: glewis
Date: Thu Oct 17 22:39:06 UTC 2019
New revision: 514690
URL: https://svnweb.freebsd.org/changeset/ports/514690

  Fix file interaction

  * Load libnio in BsdNativeDispatcher, as per other OSes
  * Export getmntonname0 from libnio

  PR:		241317
  Submitted by:	cmt@

Comment 3 Greg Lewis freebsd_committer 2019-10-17 22:41:50 UTC
Thanks Christoph!  I've committed your patch and bumped PORTREVISION.