pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/35361: sysutils/amanda: prevent amverify from looping forever



>Number:         35361
>Category:       pkg
>Synopsis:       sysutils/amanda: prevent amverify from looping forever
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 05 08:40:00 +0000 2007
>Originator:     Jukka Salmi
>Release:        pkgsrc HEAD
>Environment:
>Description:
As [1]reported on the amanda-users list amverify built from Amanda
2.4.4p4 (which is the version still used in pkgsrc) might loop forever.
This problem was fixed in a later Amanda version, and a patch for
2.4.4p4 was [2]provided.
>How-To-Repeat:
n/a
>Fix:
The following patch is available from [2] and [3]:

Amanda 2.4.4p4

Prevent amverify from looping forever. Patch provided by Jean-Louis
Martineau on amanda-users:
http://groups.yahoo.com/group/amanda-users/message/55099

--- restore-src/amrestore.c     2004-11-19 08:17:15.000000000 -0500
+++ restore-src/amrestore.c     2004-11-19 13:12:30.000000000 -0500
@@ -482,6 +482,7 @@
     char *e;
     char *err;
     char *label = NULL;
+    int count_error;
 
     for(fd = 3; fd < FD_SETSIZE; fd++) {
        /*
@@ -667,24 +668,28 @@
                        get_pname());
     }
 
-    while(file.type == F_TAPESTART || file.type == F_DUMPFILE) {
-       amfree(filename);
-       filename = make_filename(&file);
+    count_error=0;
+    while(count_error < 10) {
+       if(file.type == F_TAPEEND) break;
        found_match = 0;
-       for(me = match_list; me; me = me->next) {
-           if(disk_match(&file,me->datestamp,me->hostname,me->diskname) != 0) {
-               found_match = 1;
-               break;
+       if(file.type == F_DUMPFILE) {
+           amfree(filename);
+           filename = make_filename(&file);
+           for(me = match_list; me; me = me->next) {
+               if(disk_match(&file,me->datestamp,me->hostname,me->diskname) != 
0) {
+                   found_match = 1;
+                   break;
+               }
+           }
+           fprintf(stderr, "%s: %3d: %s ",
+                           get_pname(),
+                           file_number,
+                           found_match ? "restoring" : "skipping");
+           if(file.type != F_DUMPFILE) {
+               print_header(stderr, &file);
+           } else {
+               fprintf(stderr, "%s\n", filename);
            }
-       }
-       fprintf(stderr, "%s: %3d: %s ",
-                       get_pname(),
-                       file_number,
-                       found_match ? "restoring" : "skipping");
-       if(file.type != F_DUMPFILE) {
-           print_header(stderr, &file);
-       } else {
-           fprintf(stderr, "%s\n", filename);
        }
        if(found_match) {
            restore(&file, filename, isafile);
@@ -718,6 +723,7 @@
            if((tapedev = tape_open(tapename, 0)) < 0) {
                error("could not open %s: %s", tapename, strerror(errno));
            }
+           count_error++;
        } else {
            /*
             * If the last read got something (even an error), we can
@@ -726,6 +732,7 @@
            if(tapefd_fsf(tapedev, 1) < 0) {
                error("could not fsf %s: %s", tapename, strerror(errno));
            }
+           count_error=0;
        }
        file_number++;
        read_file_header(&file, isafile);
--- server-src/amverify.sh.in   2004-10-04 07:47:06.000000000 -0400
+++ server-src/amverify.sh.in   2004-11-19 13:12:30.000000000 -0500
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#      $Id: amverify.sh.in,v 1.7.2.13.4.5.2.7 2004/10/04 11:47:06 martinea Exp 
$
+#      $Id: amverify.sh.in,v 1.7.2.13.4.5.2.6.2.2 2004/11/19 18:12:30 martinea 
Exp $
 #
 # (C) 1996 by ICEM Systems GmbH
 # Author: Axel Zinser (fifi%icem.de@localhost)
@@ -428,6 +428,7 @@
                FILE=`grep restoring $TEMP/amrestore.out \
                        | sed 's/^.*restoring //'`
                EOF=`grep "reached end of tape" $TEMP/amrestore.out`
+               EOI=`grep "reached end of information" $TEMP/amrestore.out`
                # amrestore:   0: restoring sundae._mnt_sol1_usr.19961127.1
                if [ X"$FILE" != X"" -a X"$RESULT" = X"0" ]; then
                        report "Checked $FILE"
@@ -436,6 +437,9 @@
                elif [ -n "$EOF" ]; then
                        report "End-of-Tape detected."
                        break
+               elif [ -n "$EOI" ]; then
+                       report "End-of-Information detected."
+                       break
                else
                        report "** Error detected ($FILE)"
                        echo "$VOLUME ($FILE):" >>$DEFECTS

[1] http://tech.groups.yahoo.com/group/amanda-users/message/55087
[2] http://tech.groups.yahoo.com/group/amanda-users/message/55099
[3] 
http://salmi.ch/~jukka/patches/pkgsrc/localpatches/pkgsrc-2006Q4/sysutils/amanda-server/patch-1-verify




Home | Main Index | Thread Index | Old Index