Hi Volker,

I did not answer you because I was on leave. Thank you for your attention to the problem. It looks like that you found the issue we could not find. For some reason I thought that RTLD_NOLOAD and RTLD_LAZY flags are mutually excluded, and unfortunately the reviewers did not notice that even when I pointed the problem with dl_open() out in our internal discussions. We knew that the lib detection doesn't work but since we were a bit under pressure I've pushed the JEP as it is and filed the 8154994 for further investigation which can be closed after your fix push. The procfs solution (V6) was a work around attempt which has never been approved and couldn't be pushed, so the V5 is pushed correctly. On Solaris the GTK3 library is not supported, thus it should not be a problem if isLoadedLib() will return false always there. The target platforms was Linux and OEL on which GTK2/GTK3 incompatibility is an issue. AFAIK AIX and BSD are not supported by JDK9, but I have no doubts that a solution that supports most Unix flavors is preferable, especially since it is not very difficult.

--Semyon


On 5/4/2016 9:32 PM, Volker Simonis wrote:
Hi,

can somebody please review this small change which fixes the AIX build
after change 8145547, but also fixes an incorrect usage pattern of
RTLD_NOLOAD in 8145547:

http://cr.openjdk.java.net/~simonis/webrevs/2016/8156020/
https://bugs.openjdk.java.net/browse/JDK-8156020

Here are the details from the bug report:

Change 8145547 uses the RTLD_NOLOAD flag when calling dlopen to probe
the availability of the GTK libraries.

But unfortunately RTLD_NOLOAD is not Posix and for example not
available on AIX and BSD.

I also found out, that the implementation of 8145547 contains a bug.
It uses RTLD_NOLOAD in an incorrect way. The man page for dlopen
clearly states that one of the two flags RTLD_LAZY or RTLD_NOW has to
be included in the flags. But the current implementation uses
RTLD_NOLOAD as single flag. Therefor the call to dlopen() currently
always returns NULL, no difference if the corresponding library has
been loaded already or not.

The bug report also contains a small C program which can be used to
reproduce the problem.

The fix is to only use RTLD_NOLOAD if it is defined. The change
removes the 'flags' argument from the various check() functions and
replaces it with a boolean 'load' argument. It indicates if the check
functions should just look for a previously loaded version of the GTK
libraries (i.e. if 'load' == false) or if it should additionally try
to load the libraries if that hasn't been done before (i.e. if 'load'
== true).

I hope I haven't changed the previous program semantics with my
change. At least I couldn't see any difference :)

I've built and smoke tested on Linux/Solaris and AIX with various
combinations for jdk.gtk.version,
-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel and
FileDialog implementations.

I'd like to push this directly to jdk9-dev to fix the AIX build as
fast as possible. Would that be OK?

Thank you and best regards,
Volker

Reply via email to