I tracked down the bug.  When I changed the config file, it caused 
a problem where something wasn't defined that should have been.
I uncommented the line

            #printf("Deleting backup $i ($prevFull)\n");

and added some additional prints.

Deleting backup 3 (2)
Deleting backup 2 (1)
Deleting backup 1 (0)
2005-09-01 14:54:38 removing full backup 38
idx=1
Backups->[idx]{num}=38
Dir=/backup/BackupPC/pc/ohmy.connect.home
$bpc->RmTreeDefer(/backup/BackupPC/trash,
        /backup/BackupPC/pc/ohmy.connect.home/38);
2005-09-01 14:54:38 removing full backup 45
idx=2
Backups->[idx]{num}=45
Dir=/backup/BackupPC/pc/ohmy.connect.home
$bpc->RmTreeDefer(/backup/BackupPC/trash,
         /backup/BackupPC/pc/ohmy.connect.home/45);
2005-09-01 14:54:38 removing full backup 
idx=3
Backups->[idx]{num}=
Dir=/backup/BackupPC/pc/ohmy.connect.home
$bpc->RmTreeDefer(/backup/BackupPC/trash,
         /backup/BackupPC/pc/ohmy.connect.home/);

As you can see, $Backups->[$idx]{num} is undefined, and
/backup/BackupPC/pc/ohmy.connect.home/ ends up getting deleted.

Attached is the backups file that caused this, and a patch to
prevent it from happening.  I'm sure a more elaborate fix is possible,
this is just a quick hack to keep my backup from disappearing.

30      full    1123981201      1124003490      1098563 38581962033     1090452 
38426007742     13703   173644896       0       0       0       0       3       
22015090393     83341317        0               1               0
38      full    1124672401      1124696617      1056367 38067179409     1048698 
37739002512     14586   343528039       0       0       0       0       3       
21705399598     204856563       0               1               0
44      full    1125190801      1125217121      1087640 38165232470     1076951 
37823600934     18075   356643678       0       0       0       0       3       
21778370272     175762321       0               1               0
45      full    1125277201      1125307536      1094308 38302388918     1083855 
38063883203     17883   254046361       0       0       0       0       3       
21895900938     121786792       0               1               0
46      full    1125363601      1125393681      1077120 37274009553     1038106 
36477611286     65477   838014418       581     0       0       0       3       
20993947351     437168998       0               1               0
--- BackupPC_dump.orig  Thu Sep  1 15:04:17 2005
+++ BackupPC_dump       Thu Sep  1 15:10:21 2005
@@ -1338,6 +1338,10 @@
     my($client, $Backups, $idx) = @_;
     my($Dir) = "$TopDir/pc/$client";
 
+    if( ! $Backups->[$idx]{num} ){
+        print(STDERR "Exiting because backups file may be corrupt for 
$client!\n");
+       exit(1);
+    }
     $bpc->RmTreeDefer("$TopDir/trash",
                       "$Dir/$Backups->[$idx]{num}");
     unlink("$Dir/SmbLOG.$Backups->[$idx]{num}")
Dan

Reply via email to