1.0.21.26: bullet-proof (?) use of LOAD-SHARED-OBJECT in tests
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 18 Oct 2008 08:22:16 +0000 (08:22 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 18 Oct 2008 08:22:16 +0000 (08:22 +0000)
 * Previously LOAD-SHARED-OBJECT looked for the shared object first
   in the current directory, and if it existed there, it passed the
   absolute pathname to dlopen().

   New version passes the native namestring of the designated pathname,
   absolute or relative -- which leads to dlopen() on some platforms not
   looking in the current directory unless "." is in LD_LIBRARY_PATH.

   So add TRUENAME calls to the test-suite when the .so lives there.

 * Mention the change of semantics in NEWS.

 * Delete trailing whitespace.

NEWS
src/code/foreign-load.lisp
tests/foreign-stack-alignment.impure.lisp
tests/foreign.test.sh
tests/threads.impure.lisp
tests/win32-foreign-stack-unwind.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 32e66eb..918e282 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 ;;;; -*- coding: utf-8; -*-
 changes in sbcl-1.0.22 relative to 1.0.21:
+  * minor incompatible change: LOAD-SHARED-OBJECT no longer by default looks
+    for the shared object in the current directory, but passes the native
+    namestring of the designated pathname to the operation system's shared
+    object loading function as-it.
   * minor incompatible change: --disable-debugger toplevel option now takes
     effect before processing of initialization files and --eval or --load
     options.
index 125210a..c8ee2ce 100644 (file)
@@ -69,7 +69,7 @@ will be signalled when the core is saved -- this is orthogonal from DONT-SAVE."
                         :test #'equal))
              (obj (or old (make-shared-object
                            :pathname pathname
-                           :namestring (native-namestring 
+                           :namestring (native-namestring
                                         (translate-logical-pathname pathname)
                                         :as-file t)))))
         (setf (shared-object-dont-save obj) dont-save)
index cdf8844..128d21f 100644 (file)
@@ -60,7 +60,7 @@
      #+darwin "-bundle" #-darwin "-shared"
      "-o" "stack-alignment-offset.so")
 
-(load-shared-object "stack-alignment-offset.so")
+(load-shared-object (truename "stack-alignment-offset.so"))
 
 (define-alien-routine stack-alignment-offset int (alignment int))
 (define-alien-routine trampoline int (callback (function int)))
index 8c8a79c..992ae86 100644 (file)
@@ -127,8 +127,8 @@ cat > $TEST_FILESTEM.base.lisp <<EOF
   (eval-when (:compile-toplevel :load-toplevel :execute)
     (handler-case
         (progn
-          (load-shared-object "$TEST_FILESTEM.so")
-          (load-shared-object "$TEST_FILESTEM-b.so"))
+          (load-shared-object (truename "$TEST_FILESTEM.so"))
+          (load-shared-object (truename "$TEST_FILESTEM-b.so")))
       (sb-int:unsupported-operator ()
         ;; At least as of sbcl-0.7.0.5, LOAD-SHARED-OBJECT isn't
         ;; supported on every OS. In that case, there's nothing to test,
@@ -224,7 +224,7 @@ cat > $TEST_FILESTEM.test.lisp <<EOF
   (note "/original definitions ok")
   (rename-file "$TEST_FILESTEM-b.so" "$TEST_FILESTEM-b.bak")
   (rename-file "$TEST_FILESTEM-b2.so" "$TEST_FILESTEM-b.so")
-  (load-shared-object "$TEST_FILESTEM-b.so")
+  (load-shared-object (truename "$TEST_FILESTEM-b.so"))
   (note "/reloading ok")
   (assert (= 42 foo))
   (assert (= 13 (bar)))
@@ -245,7 +245,7 @@ cat > $TEST_FILESTEM.test.lisp <<EOF
     (multiple-value-bind (val err) (ignore-errors (late-bar))
       (assert (not val))
       (assert (typep err 'undefined-alien-error)))
-    (load-shared-object "$TEST_FILESTEM-c.so")
+    (load-shared-object (truename "$TEST_FILESTEM-c.so"))
     (assert (= 43 late-foo))
     (assert (= 14 (late-bar)))
     (note "/linkage table ok"))
@@ -325,7 +325,7 @@ EOF
 build_so $TEST_FILESTEM.addr.heap
 
 run_sbcl <<EOF
-  (load-shared-object "$TEST_FILESTEM.addr.heap.so")
+  (load-shared-object (truename "$TEST_FILESTEM.addr.heap.so"))
   (define-alien-type foo (struct foo (x int) (y int)))
 
   (define-alien-variable a foo)
index 58693e1..793161b 100644 (file)
                 "-dynamiclib" "-o" "threads-foreign.so" "threads-foreign.c")
      (error "Missing shared library compilation options for this platform"))
  :search t)
-(sb-alien:load-shared-object "threads-foreign.so")
+(sb-alien:load-shared-object (truename "threads-foreign.so"))
 (sb-alien:define-alien-routine loop-forever sb-alien:void)
 (delete-file "threads-foreign.c")
 
index 2d78069..18f6230 100755 (executable)
@@ -30,7 +30,7 @@
 
 (run-compiler)
 
-(load-shared-object "win32-stack-unwind.dll")
+(load-shared-object (truename "win32-stack-unwind.dll"))
 
 
 (defvar *current-test-callback*)
index b9ed2f2..c129002 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.21.25"
+"1.0.21.26"