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-05 19:48:44.000000000 +0100 +++ scilab-6.1.0+dfsg1/debian/changelog 2021-09-09 10:30:09.000000000 +0200 @@ -1,3 +1,9 @@ +scilab (6.1.0+dfsg1-1ubuntu3.1) focal; urgency=medium + + * d/p/addLibraryPath.patch: fix crash at startup. LP: #1870813 + + -- Simon Chopin Thu, 09 Sep 2021 10:30:09 +0200 + scilab (6.1.0+dfsg1-1ubuntu3) focal; urgency=medium * fix ftbfs with new icu 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 2021-09-09 10:29:36.000000000 +0200 @@ -0,0 +1,51 @@ +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. + This patch makes things work for both openjdk 11.0.6 and 11.0.7. + Related jdk changeset: + http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/21710e014d7f +Author: Gilles Filippini +Forwarded: http://bugzilla.scilab.org/show_bug.cgi?id=16423 + +--- scilab.orig/scilab/modules/jvm/src/java/org/scilab/modules/jvm/LibraryPath.java ++++ scilab/scilab/modules/jvm/src/java/org/scilab/modules/jvm/LibraryPath.java +@@ -19,7 +19,9 @@ + /*--------------------------------------------------------------------------*/ + import java.io.IOException; + import java.io.File; ++import java.lang.reflect.Method; + import java.lang.reflect.Field; ++import java.lang.reflect.InvocationTargetException; + /*--------------------------------------------------------------------------*/ + /*http://forum.java.sun.com/thread.jspa?threadID=135560&start=15&tstart=0 */ + /*--------------------------------------------------------------------------*/ +@@ -64,14 +66,25 @@ + /* The order matter here... see bug #4022 */ + String newLibPath = System.getProperty(JAVALIBRARYPATH) + File.pathSeparator + p; + System.setProperty(JAVALIBRARYPATH, newLibPath); ++ // First try the new initLibraryPaths method + try { +- Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); +- fieldSysPath.setAccessible(true); +- if (fieldSysPath != null) { ++ final Method initLibraryPaths = ClassLoader.class.getDeclaredMethod("initLibraryPaths"); ++ initLibraryPaths.setAccessible(true); ++ initLibraryPaths.invoke(null); ++ } catch (NoSuchMethodException e) { ++ // The initLibraryPaths method doesn't exist ++ // Fallback setting sys_paths to null ++ try { ++ Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); ++ fieldSysPath.setAccessible(true); + fieldSysPath.set(System.class.getClassLoader(), null); ++ } catch (NoSuchFieldException e1) { ++ throw new IOException("Error NoSuchFieldException, could not add path to " + JAVALIBRARYPATH); ++ } catch (IllegalAccessException e1) { ++ throw new IOException("Error IllegalAccessException, could not add path to " + JAVALIBRARYPATH); + } +- } catch (NoSuchFieldException e) { +- throw new IOException("Error NoSuchFieldException, 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-05 19:48:44.000000000 +0100 +++ scilab-6.1.0+dfsg1/debian/patches/series 2021-09-09 10:30:09.000000000 +0200 @@ -15,4 +15,5 @@ ocaml_406.patch find_libs.patch strange_us_ascii_unmappable_character.patch +addLibraryPath.patch no-ftbfs-icu.patch