Subject: cl-uffi: Silently fails to load non-existent .so files
From: Mark Wooding <[email-masked]>
To: Debian Bug Tracking System <[email-masked]>
Date: Thu, 19 Jul 2007 17:19:00 +0100

Package: cl-uffi
Version: 1.5.18-2
Severity: normal
Tags: patch

On CMUCL, the uffi:load-foreign-library function attempts to use
sys::load-object-file to load .so files (rather than falling back to
alien:load-foreign as it does for other types).  However, unlike
alien:load-foreign, sys::load-object-file reports errors (e.g., failure to
find the library in question) by returning nil.  UFFI ignores this
return value (resumably assuming that it would signal an error), and
assumes it succeeded.

The following patch fixes the problem for me.

--- /usr/share/common-lisp/source/uffi/src/libraries.lisp       2006-09-03 03:31:58.000000000 +0100
+++ /tmp/mwooding/libraries.lisp        2007-07-19 17:12:39.000000000 +0100
@@ -96,7 +96,9 @@
        #+cmu
        (let ((type (pathname-type (parse-namestring filename))))
          (if (string-equal type "so")
-             (sys::load-object-file filename)
+             (multiple-value-bind (workp whinge)
+                 (sys::load-object-file filename)
+               (unless workp (error "~A" whinge)))
              (alien:load-foreign filename
                                  :libraries
                                  (convert-supporting-libraries-to-string

This bug makes attempts to load clsql-uffi fail, reporting inability to
find the symbol atol64.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages cl-uffi depends on:
ii  common-lisp-controller        6.10       This is a Common Lisp source and c

Versions of packages cl-uffi recommends:
pn  cl-uffi-tests                 <none>     (no description available)

-- no debconf information