[OpenAFS] Perl-AFS with OpenAFS >1.4.4

Ken Dreyer ktdreyer@ktdreyer.com
Mon, 11 Feb 2008 19:12:34 -0600


I'm using the Perl bindings for AFS from CPAN, and I noticed that
"make test" fails when compiling against newer versions of OpenAFS.
Version 1.4.4 was the last version I could get to work.

For example, here's version 1.4.6 (on Solaris, but in Linux it is the same):

$ make test
[ snip ]
t/AFS....#     Failed test (t/AFS.t at line 9)
#     Tried to use 'AFS'.
#     Error:  Can't load
'/home/dis/kdreyer/perl-AFS/AFS-2.4.0/src/../blib/arch/auto/AFS/AFS.so'
for module AFS: ld.so.1: perl: fatal: relocation error: file
/home/dis/kdreyer/perl-AFS/AFS-2.4.0/src/../blib/arch/auto/AFS/AFS.so:
symbol error_message: referenced symbol not found at
/usr/local/lib/perl5/5.8.6/sun4-solaris-thread/DynaLoader.pm line 230.
t/AFS....NOK 1#  at (eval 1) line 2
# Compilation failed in require at (eval 1) line 2.
& not defined at t/AFS.t line 18
# Looks like you planned 10 tests but only ran 1.
# Looks like your test died just after 1.
t/AFS....dubious
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-10
        Failed 10/10 tests, 0.00% okay


This "symbol error_message: referenced symbol not found" error come up
during any other use of the modules. I'm no C programmer, but googling
around led me to wonder if I should change error_message to
afs_error_message:

http://www.openafs.org/cgi-bin/cvsweb.cgi/openafs/src/libafsrpc/afsrpc.def.diff?r1=1.3.2.9&r2=1.3.2.10
http://root.cern.ch/viewvc/trunk/configure?r1=21664&r2=21663&pathrev=21664

So I made the following changes, and now the module works. The point
of this email is to to see if anyone else has dealt with this problem,
or to check with someone who knows C (or libafsrpc) to see if this is
the "correct" way to make this work.

Thanks!
- Ken Dreyer


--- src/AFS.xs.orig 2008-02-11 18:32:23.354866000 -0500
+++ src/AFS.xs  2008-02-11 19:48:29.984554000 -0500
@@ -87,6 +87,7 @@
 #include <afs/bosint.h>
 #include <afs/bnode.h>
 #include <afs/ktime.h>
+#include <afs/com_err.h>
 #include <des.h>

 #include <afs/volint.h>
@@ -205,10 +206,10 @@
     else {
         if (raise_exception) {
             char buffer[1024];
-            sprintf(buffer, "AFS exception: %s (%d)",
error_message(code), code);
+            sprintf(buffer, "AFS exception: %s (%d)",
afs_error_message(code), code);
             croak(buffer);
         }
-        sv_setpv(sv, (char *) error_message(code));
+        sv_setpv(sv, (char *) afs_error_message(code));
     }
     SvIOK_on(sv);
 }
@@ -2076,7 +2077,7 @@
     else if (acode == -3)
         return "communications timeout (-3)";
     else
-        return (char *) error_message(acode);
+        return (char *) afs_error_message(acode);
 }

 static struct rx_connection *internal_bos_new(code, hostname,
localauth, noauth, aencrypt,
@@ -11186,7 +11187,7 @@
                   message = "Authentication Server was unavailable";
                   break;
               default:
-                  message = (char *) error_message(code);
+                  message = (char *) afs_error_message(code);
             }
             sv_setpv(ST(4), message);
         }
@@ -11593,7 +11594,7 @@
     PPCODE:
     {
         ST(0) = sv_newmortal();
-        sv_setpv(ST(0), (char *) error_message(code));
+        sv_setpv(ST(0), (char *) afs_error_message(code));
         XSRETURN(1);
     }