GNU bug report logs - #46451
[PATCH 0/2] OpenJDK: Fix NullPointerException when accessing fonts

Previous Next

Package: guix-patches;

Reported by: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>

Date: Thu, 11 Feb 2021 23:15:02 UTC

Severity: normal

Tags: patch

Done: Leo Prikler <leo.prikler <at> student.tugraz.at>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 46451 <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: 46451 <at> debbugs.gnu.org
Subject: [PATCH 1/2] gnu: openjdk <at> 9 : Add phase to hardcode libraries.
Date: Fri, 12 Feb 2021 00:20:16 +0100
[Message part 1 (text/plain, inline)]
* gnu/packages/java.scm (openjdk9)[arguments]: Add patch-jni-libs phase.

This fixes a NullPointerException related to using fontconfig
reported by Jonathan Frederickson <jonathan <at> terracrypt.net>
in <https://bugs.gnu.org/41177>.
---
 gnu/packages/java.scm | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d6afb2e9d3..a63dad8755 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -10,7 +10,7 @@
 ;;; Copyright © 2018, 2019 Gábor Boskovits <boskovits <at> gmail.com>
 ;;; Copyright © 2018 Chris Marusich <cmmarusich <at> gmail.com>
 ;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim <at> flashner.co.il>
-;;; Copyright © 2019, 2020 Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
+;;; Copyright © 2019, 2020, 2021 Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan <at> disroot.org>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
@@ -1928,6 +1928,33 @@ new Date();"))
                                                  (number->string (parallel-job-count))))
                             '())
                       ,@make-flags))))
+         (add-after 'unpack 'patch-jni-libs
+           ;; Hardcode dynamically loaded libraries.
+           (lambda _
+             (let* ((library-path (search-path-as-string->list
+                                   (getenv "LIBRARY_PATH")))
+                    (find-library (lambda (name)
+                                    (search-path
+                                     library-path
+                                     (string-append "lib" name ".so")))))
+               (for-each
+                (lambda (file)
+                  (catch 'decoding-error
+                    (lambda ()
+                      (substitute* file
+                        (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
+                          _ name version)
+                         (format #f "\"~a\""  (find-library name)))
+                        (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
+                         (format #f "\"~a\"" (find-library name)))))
+                    (lambda _
+                      ;; Those are safe to skip.
+                      (format (current-error-port)
+                                      "warning: failed to substitute: ~a~%"
+                                      file))))
+                (find-files "."
+                            "\\.c$|\\.h$"))
+               #t)))
          ;; Some of the libraries in the lib/ folder link to libjvm.so.
          ;; But that shared object is located in the server/ folder, so it
          ;; cannot be found.  This phase creates a symbolic link in the
-- 
2.27.0

[Message part 2 (application/pgp-signature, inline)]

This bug report was last modified 4 years and 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.