~ chicken-core (chicken-5) 8b8bb18a6ebfef477935356bdf73c6eb2c3f0435


commit 8b8bb18a6ebfef477935356bdf73c6eb2c3f0435
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Fri Apr 27 21:11:21 2018 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Apr 27 21:36:05 2018 +0200

    Fix import-library-hook in eval-modules so it won't call #f
    
    When used in a statically compiled program, the '##sys#import property
    will be missing from the module if it isn't linked into the program.
    We were calling the procedure value on the '##sys#import property,
    instead of checking whether it is set.
    
    Found during investigation of #1437
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/eval-modules.scm b/eval-modules.scm
index e05e2bd3..5724c294 100644
--- a/eval-modules.scm
+++ b/eval-modules.scm
@@ -98,6 +98,5 @@
 (set! ##sys#import-library-hook
   (let ((hook ##sys#import-library-hook))
     (lambda (mname)
-      (let ((il (get mname '##sys#import)))
-        (or (il)
-            (hook mname))))))
+      (cond ((get mname '##sys#import) => (lambda (il) (il)))
+	    (else (hook mname)) ) ) ) )
Trap