[OpenAFS] AFS Perl under debian lenny - problem?

Norbert Gruener nog@MPA-Garching.MPG.DE
Thu, 15 May 2008 14:25:24 +0200


--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi Lars,

On Mon, May 05 2008, Lars Schimmer wrote:
> 
> Hi!
> 
> I used to use the afsss.pl script from mr. Wiesand
> http://www-zeuthen.desy.de/~wiesand/AFS/ and all was fine after I got
> the perl modules as a .deb.
> 
> But since a few days (after some updates) I get this error:
> 
> vldb->listaddrs Code=AFS::VLDB: could not list the server addresses
> 
> Is anyone else using the AFS::VLDB package or the script on debian
> lenny/etch and can give me a hint what went wrong?

the appended patch should solve your problem.  Please let me know if
it is working for you.

Cheers,

Norbert
-- 
Ceterum censeo          | PGP encrypted mail preferred.
Redmond esse delendam.  | PGP Key at www.MPA-Garching.MPG.de/~nog/

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename="lars.patch"
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mpadmx-4.MPA-Garching.MPG.DE id m4FCPOtR018457

--- AFS-2.4.0-p/src/Makefile.PL.orig	2005-12-22 07:32:52.000000000 +0100
+++ AFS-2.4.0-p/src/Makefile.PL	2008-05-15 14:17:58.000000000 +0200
@@ -1,7 +1,7 @@
 #-----------------------------------------------------------------------=
-------
-# RCS-Id: "@(#)$Id: Makefile.PL 751 2005-12-22 06:32:52Z nog $"
+# RCS-Id: "@(#)$Id: Makefile.PL 785 2007-07-12 07:16:12Z nog $"
 #
-# Copyright =A9 2001-2005 Norbert E. Gruener <nog@MPA-Garching.MPG.de>
+# Copyright =A9 2001-2007 Norbert E. Gruener <nog@MPA-Garching.MPG.de>
 #
 # This library is free software; you can redistribute it and/or modify i=
t
 # under the same terms as Perl itself.
@@ -74,19 +74,12 @@
 if    (-r "/usr/local/include/afs/afs.h") { $guess_path =3D '/usr/local'=
; }
 elsif (-r "/usr/afsws/include/afs/afs.h") { $guess_path =3D '/usr/afsws'=
; }
 elsif (-r "/usr/include/afs/afs.h")       { $guess_path =3D '/usr'; }
+else                                      { $guess_path =3D 'unknown'; }
=20
-my $AFSPath;
-if (defined $ENV{AFSPATH}) {
-    $AFSPath =3D $ENV{AFSPATH};
-}
-else {
-    $AFSPath =3D $guess_path || 'unknown';
-    print "\nPath to the AFS installation (libraries, binaries, \n";
-    print "header files) to be used for this installation? \t [$AFSPath]=
 ";
-    chomp(my $answer =3D <STDIN>);
-    $AFSPath =3D $answer if $answer;
-    print "\n";
-}
+my $AFSPath =3D $ENV{AFSPATH} || $guess_path;
+my $msg =3D "\nPath to the AFS installation (libraries, binaries, \n"
+        . "header files) to be used for this installation? \t ";
+$AFSPath =3D prompt($msg, $AFSPath);
 $AFSPath =3D~ s\/$\\;
=20
 # determine the alpha_sys value
@@ -104,6 +97,8 @@
 # find out the AFS version of the AFS system libraries
 open FILE, ">fotav.c";
 print FILE <<'EOF';
+#include <stdio.h>
+
 int main(void)
 {
   extern char *AFSVersion;
--- AFS-2.4.0-p/src/AFS.xs.orig	2006-02-16 14:13:16.000000000 +0100
+++ AFS-2.4.0-p/src/AFS.xs	2008-05-15 14:18:11.000000000 +0200
@@ -2,7 +2,7 @@
  *
  * AFS.xs - AFS extensions for Perl
  *
- * RCS-Id: @(#)$Id: AFS.xs 772 2006-02-16 13:13:16Z nog $
+ * RCS-Id: @(#)$Id: AFS.xs 790 2008-02-07 08:12:33Z nog $
  *
  * Copyright (c) 2003, International Business Machines Corporation and o=
thers.
  *
@@ -11,7 +11,7 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  *
  * Contributors
- *    2004-2006: Norbert E. Gruener <nog@MPA-Garching.MPG.de>
+ *    2004-2008: Norbert E. Gruener <nog@MPA-Garching.MPG.de>
  *         2003: Alf Wachsmann <alfw@slac.stanford.edu>
  *               Venkata Phani Kiran Achanta <neo_phani@hotmail.com>, an=
d
  *               Norbert E. Gruener <nog@MPA-Garching.MPG.de>
@@ -54,6 +54,7 @@
 #include <stdio.h>
 #include <netinet/in.h>
 #include <sys/stat.h>
+#undef INIT
 #include <afs/stds.h>
 #include <afs/afs.h>
 #include <afs/afsint.h>
@@ -97,7 +98,7 @@
 #define uint32 afs_uint32
 #endif
=20
-const char *const xs_version =3D "AFS.xs (Major Version 2.4 $Rev: 772 $)=
";
+const char *const xs_version =3D "AFS.xs (Major Version 2.4 $Rev: 790 $)=
";
=20
 /* here because it seemed too painful to #define KERNEL before #inc afs.=
h */
 struct VenusFid {
@@ -1348,7 +1349,6 @@
     char pname[10];
     char hostname[256];
=20
-    hv_store(vol, "name", 4,  newSVpv(pntr->name, strlen((char *) pntr->=
name)), 0);
     if (fast) {
         hv_store(vol, "volid", 5, newSViv(pntr->volid), 0);
     }
@@ -1357,7 +1357,7 @@
         hv_store(vol, "volid", 5, newSViv(pntr->volid), 0);
=20
         if (pntr->status =3D=3D VOK) {
-
+            hv_store(vol, "name", 4,  newSVpv(pntr->name, strlen((char *=
) pntr->name)), 0);
             if (pntr->type =3D=3D 0)
                 hv_store(vol, "type", 4, newSVpv("RW", 2), 0);
             if (pntr->type =3D=3D 1)
@@ -1429,9 +1429,9 @@
=20
     /* Fully-detailed listing. */
     hv_store(stats, "status", 6, newSViv(a_xInfoP->status), 0);
+    hv_store(stats, "volid", 5, newSViv(a_xInfoP->volid), 0);
     if (a_xInfoP->status =3D=3D VOK) {
         /* Volume's status is OK - all the fields are valid. */
-        hv_store(stats, "volid", 5, newSViv(a_xInfoP->volid), 0);
=20
         if (a_xInfoP->type =3D=3D 0)
             hv_store(stats, "type", 4, newSVpv("RW", 2), 0);
@@ -1610,10 +1610,24 @@
     for (i =3D 0; i < count; i++) {
         HV *vol =3D (HV *) sv_2mortal((SV *) newHV());
         myDisplayFormat(vol, pntr, server, part, &totalOK, &totalNotOK, =
&totalBusy, fast);
-        hv_store(partition, pntr->name, strlen(pntr->name), newRV_inc((S=
V *) (vol)), 0);
+        char buff[32];
+        if (pntr->status =3D=3D VOK) {
+            hv_store(partition, pntr->name, strlen(pntr->name), newRV_in=
c((SV *) (vol)), 0);
+        }
+        else if (pntr->status =3D=3D VBUSY) {
+            sprintf(buff, "volume_busy_%d", i);
+            hv_store(partition, buff, strlen(buff), newRV_inc((SV *) (vo=
l)), 0);
+            /* fprintf(STDERR, "DEBUG-1: %s %d\n", buff, strlen(buff)); =
*/
+        }
+        else {
+            sprintf(buff, "volume_notok_%d", i);
+            hv_store(partition, buff, strlen(buff), newRV_inc((SV *) (vo=
l)), 0);
+            /* fprintf(STDERR, "DEBUG-2: %s %d\n", buff, strlen(buff)); =
*/
+        }
         pntr++;
     }
     if (!fast) {
+        hv_store(partition, " totalOK", 8, newSViv(totalOK), 0);
         hv_store(partition, " totalBusy", 10, newSViv(totalBusy), 0);
         hv_store(partition, " totalNotOK", 11, newSViv(totalNotOK), 0);
     }
@@ -1715,12 +1729,25 @@
                          a_xInfoP,
                          a_servID,
                          a_partID, &totalOK, &totalNotOK, &totalBusy);
-        hv_store(part, a_xInfoP->name, strlen(a_xInfoP->name), newRV_inc=
((SV *) (vol)),
-                 0);
+        char buff[32];
+        if (a_xInfoP->status =3D=3D VOK) {
+            hv_store(part, a_xInfoP->name, strlen(a_xInfoP->name), newRV=
_inc((SV *) (vol)), 0);
+        }
+        else if (a_xInfoP->status =3D=3D VBUSY) {
+            sprintf(buff, "volume_busy_%d", i);
+            hv_store(part, buff, strlen(buff), newRV_inc((SV *) (vol)), =
0);
+            /* fprintf(STDERR, "DEBUG-1: %s %d\n", buff, strlen(buff)); =
*/
+        }
+        else {
+            sprintf(buff, "volume_notok_%d", i);
+            hv_store(part, buff, strlen(buff), newRV_inc((SV *) (vol)), =
0);
+            /* fprintf(STDERR, "DEBUG-2: %s %d\n", buff, strlen(buff)); =
*/
+        }
         a_xInfoP++;
     }
=20
     /* If any volumes were found to be busy or screwed, display them.*/
+    hv_store(part, " totalOK", 8, newSViv(totalOK), 0);
     hv_store(part, " totalBusy", 10, newSViv(totalBusy), 0);
     hv_store(part, " totalNotOK", 11, newSViv(totalNotOK), 0);
 }                               /*XDisplayVolumes */
@@ -1771,9 +1798,9 @@
=20
         if (isMixed) {
             if (entry->serverFlags[i] & NEW_REPSITE)
-                hv_store(server, "release", 7, newSVpv("New release", 12=
), 0);
+                hv_store(server, "release", 7, newSVpv("New release", 11=
), 0);
             else
-                hv_store(server, "release", 7, newSVpv("Old release", 12=
), 0);
+                hv_store(server, "release", 7, newSVpv("Old release", 11=
), 0);
         }
         else {
             if (entry->serverFlags[i] & RO_DONTUSE)
@@ -2191,7 +2218,7 @@
             *code =3D ktc_GetToken(&sname, &ttoken, sizeof(ttoken), (cha=
r *) 0);
             if (*code =3D=3D 0) {
                 /* have tickets, will travel */
-                if (ttoken.kvno >=3D 0 && ttoken.kvno <=3D 255);
+                if (ttoken.kvno >=3D 0 && ttoken.kvno <=3D 256);
                 else {
                     fprintf(stderr,
                             "AFS::BOS: funny kvno (%d) in ticket, procee=
ding\n",
@@ -5565,11 +5592,10 @@
         int extended
   PREINIT:
         afs_int32 apart =3D -1, aserver, code =3D 0;
-        volintInfo *pntr,*oldpntr;
+        volintInfo *pntr;
         afs_int32 count;
         int i;
-        char *base;
-        volintXInfo *xInfoP, *origxInfoP;   /*Ptr to current/orig extend=
ed vol info*/
+        volintXInfo *xInfoP;                /*Ptr to current/orig extend=
ed vol info*/
         int wantExtendedInfo;               /*Do we want extended vol in=
fo?*/
=20
         char pname[10];
@@ -5661,21 +5687,13 @@
                     XSRETURN_UNDEF;
                     goto done;
                 }
-                if (wantExtendedInfo) {
-                    origxInfoP =3D xInfoP;
-                    base =3D (char *) xInfoP;
-                }
-                else {
-                    oldpntr =3D pntr;
-                    base =3D (char *) pntr;
-                }
        =20
                 MapPartIdIntoName(dummyPartList.partId[i], pname);
                 if (wantExtendedInfo) {
                     XDisplayVolumes(part,
                                     aserver,
                                     dummyPartList.partId[i],
-                                    origxInfoP, count);
+                                    xInfoP, count);
                     if (xInfoP)
                         Safefree(xInfoP);
                     xInfoP =3D (volintXInfo *) 0;
@@ -5684,7 +5702,7 @@
                     DisplayVolumes(part,
                                    aserver,
                                    dummyPartList.partId[i],
-                                   oldpntr, count, fast);
+                                   pntr, count, fast);
                     if (pntr)
                         Safefree(pntr);
                     pntr =3D (volintInfo *) 0;
@@ -6932,6 +6950,11 @@
                 continue;
             }
        =20
+            if (vcode =3D=3D VL_INDEXERANGE) {
+                vcode =3D 0;
+                break;
+            }
+
             if (vcode) {
                 char buffer[80];
                 sprintf(buffer, "AFS::VLDB: could not list the server ad=
dresses\n");
--- AFS-2.4.0-p/Makefile.PL.orig	2005-12-15 13:49:23.000000000 +0100
+++ AFS-2.4.0-p/Makefile.PL	2008-05-15 14:17:45.000000000 +0200
@@ -16,16 +16,6 @@
     $rm_file =3D './src/AFS.pm';
 }
=20
-WriteMakefile(
-              'NAME'       =3D> 'AFS',
-              'VERSION'    =3D> $VERSION,
-              ($] >=3D 5.005 ?
-                   ('AUTHOR'   =3D> 'Norbert E Gruener <nog@MPA-Garching=
.MPG.de>',
-                    'ABSTRACT' =3D> 'Perl interface to AFS programming A=
PIs',
-                    'NO_META'  =3D> true) : () ),
-              'realclean'  =3D> {FILES =3D> "Makefile.bak pod/v2/*.html =
pod/v2/pod2htm* lib $rm_file" },
-             );
-
 # provide the POD documentation
 mkdir('./lib');
 mkdir('./lib/AFS');
@@ -45,6 +35,16 @@
 system("cp ./pod/v2/afsperlvldb.pod lib/AFS/VLDB.pod");
 system("cp ./pod/v2/afsperlvos.pod lib/AFS/VOS.pod");
=20
+WriteMakefile(
+              'NAME'       =3D> 'AFS',
+              'VERSION'    =3D> $VERSION,
+              ($] >=3D 5.005 ?
+                   ('AUTHOR'   =3D> 'Norbert E Gruener <nog@MPA-Garching=
.MPG.de>',
+                    'ABSTRACT' =3D> 'Perl interface to AFS programming A=
PIs',
+                    'NO_META'  =3D> true) : () ),
+              'realclean'  =3D> {FILES =3D> "Makefile.bak pod/v2/*.html =
pod/v2/pod2htm* lib $rm_file" },
+             );
+
 sub MY::postamble {
         '
 html: Makefile

--envbJBWh7q8WU6mo--