unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Carlo Zancanaro <carlo@zancanaro.id.au>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Ricardo Wurmus <rekado@elephly.net>, 31719@debbugs.gnu.org
Subject: bug#31719: icedtea-3 binaries contain references to icedtea-2
Date: Tue, 20 Apr 2021 21:32:10 +1000	[thread overview]
Message-ID: <87tuo18a4l.fsf@zancanaro.id.au> (raw)
In-Reply-To: <878s5de2ac.fsf_-_@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

Hi Ludo!

On Tue, Apr 20 2021, Ludovic Courtès wrote:
>                      (find-library (lambda (name)
> -                                    (or (search-path
> -                                         library-path
> -                                         (string-append "lib" 
> name ".so"))
> -                                        (string-append "lib" 
> name ".so")))))
> +                                    (search-path
> +                                     library-path
> +                                     (string-append "lib" name 
> ".so")))))
>                 (for-each

As discussed on IRC, the "or" is actually important here to avoid 
substituting #f as the library name. I've attached a patch on top 
of yours that adds the "or" back (including the other two that I 
missed in my earlier patch), and also switches to "string-append" 
which is less sensitive to this problem.

I have built up to openjdk11 with this patch, and I see less #f's 
in the result. There are still some in the compiled libraries, but 
I haven't investigated thoroughly as to whether they're correct or 
not.

Carlo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Fix-openjdk-library-substitution-when-libraries-.patch --]
[-- Type: text/x-diff, Size: 5205 bytes --]

From 60101b27543b7cc41a052d5bec95234ea4977d35 Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Tue, 20 Apr 2021 21:22:20 +1000
Subject: [PATCH] gnu: Fix openjdk library substitution when libraries aren't
 found

* gnu/packages/java.scm (icedtea-8, openjdk9, openjdk11): Fix JNI library
substitution to not substitute #f if the library can't be found.
---
 gnu/packages/java.scm | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index b780f7a85f..8a1ba5f262 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1806,9 +1806,10 @@ new Date();"))
                                                   (search-path-as-string->list
                                                    (getenv "LIBRARY_PATH"))))
                             (find-library (lambda (name)
-                                            (search-path
-                                             library-path
-                                             (string-append "lib" name ".so")))))
+                                            (or (search-path
+                                                 library-path
+                                                 (string-append "lib" name ".so"))
+                                                (string-append "lib" name ".so")))))
                        (for-each
                         (lambda (file)
                           (catch 'decoding-error
@@ -1816,9 +1817,9 @@ new Date();"))
                               (substitute* file
                                 (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
                                   _ name version)
-                                 (format #f "\"~a\""  (find-library name)))
+                                 (string-append "\"" (find-library name) "\""))
                                 (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
-                                 (format #f "\"~a\"" (find-library name)))))
+                                 (string-append "\"" (find-library name) "\""))))
                             (lambda _
                               ;; Those are safe to skip.
                               (format (current-error-port)
@@ -1956,9 +1957,10 @@ new Date();"))
                                           (search-path-as-string->list
                                            (getenv "LIBRARY_PATH"))))
                     (find-library (lambda (name)
-                                    (search-path
-                                     library-path
-                                     (string-append "lib" name ".so")))))
+                                    (or (search-path
+                                         library-path
+                                         (string-append "lib" name ".so"))
+                                        (string-append "lib" name ".so")))))
                (for-each
                 (lambda (file)
                   (catch 'decoding-error
@@ -1966,9 +1968,9 @@ new Date();"))
                       (substitute* file
                         (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
                           _ name version)
-                         (format #f "\"~a\""  (find-library name)))
+                         (string-append "\"" (find-library name) "\""))
                         (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
-                         (format #f "\"~a\"" (find-library name)))))
+                         (string-append "\"" (find-library name) "\""))))
                     (lambda _
                       ;; Those are safe to skip.
                       (format (current-error-port)
@@ -2177,9 +2179,10 @@ new Date();"))
                                           (search-path-as-string->list
                                            (getenv "LIBRARY_PATH"))))
                     (find-library (lambda (name)
-                                    (search-path
-                                     library-path
-                                     (string-append "lib" name ".so")))))
+                                    (or (search-path
+                                         library-path
+                                         (string-append "lib" name ".so"))
+                                        (string-append "lib" name ".so")))))
                (for-each
                 (lambda (file)
                   (catch 'decoding-error
@@ -2187,9 +2190,9 @@ new Date();"))
                       (substitute* file
                         (("VERSIONED_JNI_LIB_NAME\\(\"(.*)\", \"(.*)\"\\)"
                           _ name version)
-                         (format #f "\"~a\""  (find-library name)))
+                         (string-append "\"" (find-library name) "\""))
                         (("JNI_LIB_NAME\\(\"(.*)\"\\)" _ name)
-                         (format #f "\"~a\"" (find-library name)))))
+                         (string-append "\"" (find-library name) "\""))))
                     (lambda _
                       ;; Those are safe to skip.
                       (format (current-error-port)
-- 
2.31.1


  parent reply	other threads:[~2021-04-20 11:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 10:47 bug#31719: icedtea-3 binaries contain references to icedtea-2 Ricardo Wurmus
2018-06-05 11:49 ` Gábor Boskovits
2018-06-05 12:36   ` Ricardo Wurmus
2018-06-05 12:45   ` Leo Famulari
2018-06-05 14:45     ` Gábor Boskovits
2018-09-10 21:00 ` Gábor Boskovits
2020-05-14 18:02 ` Ricardo Wurmus
2021-02-27 11:17 ` bug#31719: Chains of dependencies getting longer Andreas Enge
2021-03-01 10:04   ` Ludovic Courtès
2021-03-01 12:00     ` Andreas Enge
2021-03-01 21:33       ` Ludovic Courtès
2021-03-01 22:15         ` Björn Höfling
2021-04-14  7:36           ` Ricardo Wurmus
2021-04-16 19:22             ` Björn Höfling
2021-04-16 22:26               ` Carlo Zancanaro
2021-04-17  7:11                 ` Carlo Zancanaro
2021-04-17  9:38                   ` Carlo Zancanaro
2021-04-19 16:22                     ` Andreas Enge
2021-04-19 18:18                       ` Ricardo Wurmus
2021-04-20  8:34                         ` Andreas Enge
2021-04-20  9:24                           ` bug#31719: icedtea-3 binaries contain references to icedtea-2 Ludovic Courtès
2021-04-20  9:36                             ` Andreas Enge
2021-04-20 11:32                             ` Carlo Zancanaro [this message]
2021-04-20 16:38                               ` Ludovic Courtès
2021-04-20 21:00                                 ` Carlo Zancanaro
2021-04-21 12:40                                   ` Ludovic Courtès
2021-04-20  9:01                         ` bug#31719: Chains of dependencies getting longer Carlo Zancanaro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tuo18a4l.fsf@zancanaro.id.au \
    --to=carlo@zancanaro.id.au \
    --cc=31719@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).