Bug#955694: scilab: FTBFS: Scilab cannot create Scilab Java Main-Class (we have not been able to find the main Scilab class. Check if the Scilab and thirdparty packages are available).

Gilles Filippini pini at debian.org
Wed Apr 22 23:20:52 BST 2020


Control: tag -1 + patch

Gilles Filippini a écrit le 22/04/2020 à 19:35 :
> Gilles Filippini a écrit le 22/04/2020 à 09:59 :
>> Hi,
>>
>> Matthias Klose a écrit le 20/04/2020 à 12:49 :
>>> On 4/20/20 11:52 AM, Gilles Filippini wrote:
>>>> I'd like to do a bisect between openjdk-11 11.0.6+10-2 and 11.0.7+9-1 to
>>>> better understand the problem but I can't find the corresponding branch
>>>> on the openjdk Mercurial repo.
>>>
>>> http://hg.openjdk.java.net/jdk-updates/jdk11u/
>>>
>>
>> This commit is the culprit:
>> http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/21710e014d7f
>>
>> It makes sense since it is related to System.loadLibrary().
>>
>> Because Scilab loads Java from C++ code I guess moving usr_paths ans
>> sys_paths initialization out of System.loadLibrary might have some
>> consequences.
>>
>> Applying the attached patch to openjdk-11 solves the problem. Not sure
>> this is the right thing to do, but it keeps the deadlock fix brought by
>> the jdk changeset and allows for sys_paths and usr_paths initialization
>> in System.loadLibrary() when needed.
>>
>> @doko, please consider adding this patch to the openjdk-11 source
>> package until a proper fix is found for Scilab.
> 
> I think I've eventually found a fix for Scilab. Please hold.

Here it is, attached.

_g.
-------------- next part --------------
diff -Nru scilab-6.1.0+dfsg1/debian/changelog scilab-6.1.0+dfsg1/debian/changelog
--- scilab-6.1.0+dfsg1/debian/changelog	2020-03-01 17:03:05.000000000 +0100
+++ scilab-6.1.0+dfsg1/debian/changelog	2020-04-22 21:55:44.000000000 +0200
@@ -1,3 +1,11 @@
+scilab (6.1.0+dfsg1-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * New patch addLibraryPath.patch to fix NullPointerExeption with
+    openjdk >= 11.0.7+9 (closes: #955694, #956908)
+
+ -- Gilles Filippini <pini at debian.org>  Wed, 22 Apr 2020 21:55:44 +0200
+
 scilab (6.1.0+dfsg1-1) unstable; urgency=medium
 
   * Package new upstream release 6.1.0.
diff -Nru scilab-6.1.0+dfsg1/debian/patches/addLibraryPath.patch scilab-6.1.0+dfsg1/debian/patches/addLibraryPath.patch
--- scilab-6.1.0+dfsg1/debian/patches/addLibraryPath.patch	1970-01-01 01:00:00.000000000 +0100
+++ scilab-6.1.0+dfsg1/debian/patches/addLibraryPath.patch	2020-04-22 21:55:44.000000000 +0200
@@ -0,0 +1,40 @@
+Description: Starting with openjdk 11.0.7+9 it is not possible anymore
+ to force java.library.path reload by setting sys_paths to null.
+ Related jdk changeset:
+ http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/21710e014d7f
+Author: Gilles Filippini <pini at debian.org>
+Index: scilab-6.1.0+dfsg1/scilab/modules/jvm/src/java/org/scilab/modules/jvm/LibraryPath.java
+===================================================================
+--- scilab-6.1.0+dfsg1.orig/scilab/modules/jvm/src/java/org/scilab/modules/jvm/LibraryPath.java
++++ scilab-6.1.0+dfsg1/scilab/modules/jvm/src/java/org/scilab/modules/jvm/LibraryPath.java
+@@ -19,7 +19,8 @@ package org.scilab.modules.jvm;
+ /*--------------------------------------------------------------------------*/
+ import java.io.IOException;
+ import java.io.File;
+-import java.lang.reflect.Field;
++import java.lang.reflect.Method;
++import java.lang.reflect.InvocationTargetException;
+ /*--------------------------------------------------------------------------*/
+ /*http://forum.java.sun.com/thread.jspa?threadID=135560&start=15&tstart=0 */
+ /*--------------------------------------------------------------------------*/
+@@ -65,13 +66,13 @@ public class LibraryPath {
+             String newLibPath = System.getProperty(JAVALIBRARYPATH) + File.pathSeparator + p;
+             System.setProperty(JAVALIBRARYPATH, newLibPath);
+             try {
+-                Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
+-                fieldSysPath.setAccessible(true);
+-                if (fieldSysPath != null) {
+-                    fieldSysPath.set(System.class.getClassLoader(), null);
+-                }
+-            } catch (NoSuchFieldException e) {
+-                throw new IOException("Error NoSuchFieldException, could not add path to " + JAVALIBRARYPATH);
++                final Method initLibraryPaths = ClassLoader.class.getDeclaredMethod("initLibraryPaths"); 
++                initLibraryPaths.setAccessible(true); 
++                initLibraryPaths.invoke(null); 
++            } catch (NoSuchMethodException e) {
++                throw new IOException("Error NoSuchMethodException, could not add path to " + JAVALIBRARYPATH);
++            } catch (InvocationTargetException e) {
++                throw new IOException("Error InvocationTargetException, could not add path to " + JAVALIBRARYPATH);
+             } catch (IllegalAccessException e) {
+                 throw new IOException("Error IllegalAccessException, could not add path to " + JAVALIBRARYPATH);
+             }
diff -Nru scilab-6.1.0+dfsg1/debian/patches/series scilab-6.1.0+dfsg1/debian/patches/series
--- scilab-6.1.0+dfsg1/debian/patches/series	2020-03-01 17:03:05.000000000 +0100
+++ scilab-6.1.0+dfsg1/debian/patches/series	2020-04-22 21:50:35.000000000 +0200
@@ -15,3 +15,4 @@
 ocaml_406.patch
 find_libs.patch
 strange_us_ascii_unmappable_character.patch
+addLibraryPath.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20200423/81e5068d/attachment.sig>


More information about the debian-science-maintainers mailing list