BackupPC-users

Re: [BackupPC-users] Bizarre form of cpool corruption.

2010-12-06 20:04:20
Subject: Re: [BackupPC-users] Bizarre form of cpool corruption.
From: Robin Lee Powell <rlpowell AT digitalkingdom DOT org>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 6 Dec 2010 17:02:06 -0800
On Mon, Dec 06, 2010 at 01:17:43PM -0800, Robin Lee Powell wrote:
> 
> So, yeah.  More than one link, matches something in the pool, but
> not actually linked to it.  Isn't that *awesome*?  ;'(
> 
> I very much want BackupPC_fixLinks to deal with this, and I'm
> trying to modify it to do that now.

Seems to be working; here's the diff.  Feel free to drop the print
statements.  :)

For all I know this will eat your dog; I have no idea what else I
broke.  I *do* know that it should be a flag, because I expect that
checksumming *everything* takes a very, very long time.

-Robin

--- /usr/local/bin/BackupPC_fixLinks    2010-12-05 10:38:42.028375381 +0000
+++ /tmp/BackupPC_fixLinks      2010-12-06 22:53:00.174783302 +0000
@@ -358,6 +358,7 @@
 sub BadOrMissingLinks {
         my $matchpath = $_[0];
         (my $matchname = $matchpath) =~ s|^$pc/*||; # Delete leading path 
directories (up to machine)
+       print "file: $matchpath\n";

         my $rettype;
         my $matchtype;
@@ -368,7 +369,7 @@
                 warnerr "Can't stat: $matchpath\n";
                 return;
         }
-        if ($nlinkM == 1 && $sizeM > 0) { # Non-zero file with no link to pool
+        if ($sizeM > 0) { # Non-zero file with no link to pool
                 my $matchbyte = firstbyte($matchpath);
                 my $comparflg = 'x';  # Default if no link to pool
                 my $matchtype = "NewFile"; # Default if no link to pool
@@ -386,6 +387,11 @@
                 my $md5sumpath = my $md5sumpathbase = $bpc->MD52Path($md5sum, 
0, $thepooldir);
                 my $i;
                 for ($i=-1; -f $md5sumpath ; $md5sumpath = $md5sumpathbase . 
'_' . ++$i) {
+                       my $md5sumpathinode = (stat($md5sumpath))[1];
+                       # This is actually a correct and matching link; do 
nothing
+                       if( $md5sumpathinode == $inoM ) {
+                               return -1;
+                       }
             #Again start at the root, try to find best match in pool...
                         if ((my $cmpresult  = compare_files ($matchpath, 
$md5sumpath, $cmprsslvl)) > 0) { #match found

@@ -405,6 +411,7 @@
                                 $matchtype = "NewLink";
                                 $totnewlinks++;
                                 $rettype=2; #NewLink
+                                       print "NEW LINK files: `/bin/ls -li 
$matchpath $md5sumpath` \n";
                                 goto match_return;
                         } #Otherwise, continue to move up the chain looking 
for a pool match...
                 }
@@ -420,6 +427,7 @@
                         $md5sumhash{$fullmd5sum} = $md5sum;
                         $rettype=3; #NewFile-x
                 }
+                                       print "NO MATCH files: `/bin/ls -li 
$matchpath $md5sumpath` \n";

           match_return:
                 @MatchA = ($matchname, $inoM, $md5sum, $matchtype, $thepool, 
${comparflg}.${matchbyte}.${md5sumbyte}, $nlinkM, $sizeM);


-- 
http://singinst.org/ :  Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei".   My personal page: http://www.digitalkingdom.org/rlp/

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/