Hey,

I just switched to the new stable BackupPC version 3.1.0-4
(Debian lenny). In the process I noticed that I had to forward
port a local patch for BackupPC which I had applied to the
BackupPC version in Debian etch. After checking the CVS it
seems that the bug tackled by this patch is still unfixed.
The problem concerns the BlackoutPeriods code in BackupPC_dump
which does strange stuff if there are multiple blackout entries
in the @{$Conf{BlackoutPeriods}} which contain midnight. This
is due to a bug in the $wday handling which is clobbered in
the first entry check of this kind and is therefore wrong
for all following blackout entries. The patch is trivial
and simply copies the $wday var to a local variable $matchWday
which will be reinitialized for each blackout entry check.
(Patch included).

Regards,
Joachim Falk
-- 
Joachim Falk <joachim.f...@gmx.de>

You can always tell a really good idea by the enemies it makes.
  --programmers' axiom
--- BackupPC_dump.orig	2008-10-17 21:39:06.000000000 +0200
+++ BackupPC_dump	2009-05-08 01:00:16.000000000 +0200
@@ -336,6 +336,8 @@
     my $blackout;
 
     foreach my $p ( @{$Conf{BlackoutPeriods}} ) {
+    	# Don't clobber wday
+    	my $matchWday = $wday;
         #
         # Allow blackout to span midnight (specified by hourBegin
         # being greater than hourEnd)
@@ -353,14 +355,14 @@
                 # weekday check (eg: Monday 11pm-1am means Monday 2300 to
                 # Tuesday 0100, not Monday 2300-2400 plus Monday 0000-0100).
                 #
-                $wday--;
-                $wday += 7 if ( $wday < 0 );
+                $matchWday--;
+                $matchWday += 7 if ( $matchWday < 0 );
             }
         } else {
             $blackout = $p->{hourBegin} <= $currHours
                           && $currHours <= $p->{hourEnd};
         }
-        if ( $blackout && grep($_ == $wday, @{$p->{weekDays}}) ) {
+        if ( $blackout && grep($_ == $matchWday, @{$p->{weekDays}}) ) {
 #           print(LOG $bpc->timeStamp, "skipping because of blackout"
 #                      . " (alive $StatusHost{aliveCnt} times)\n");
             print(STDERR "Skipping $client because of blackout\n")

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
BackupPC-devel mailing list
BackupPC-devel@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-devel
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to