[Fwd: Bugfix for BlackoutPeriods in BackupPC_dump]

Joachim Falk <[email protected]>
Newsgroups gmane.comp.sysutils.backup.backuppc.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Craig,

I don't seem to get through to the backuppc-devel mailing list.
I have tried twice now waiting one month between tries. I receive
mailings to the list just fine, but mine seem to be swallowed
by the bit bucket. Use the patch every way you want, including
ignoring the problem, but please ping me if you have received
this email, to let me know if I have gotten through.

Cheers,
Joachim Falk

- -------- Original-Nachricht --------
Betreff: Bugfix for BlackoutPeriods in BackupPC_dump
Datum: Sun, 07 Jun 2009 23:26:21 +0200
Von: Joachim Falk <[email protected]>
An: [email protected]

Hey BackupPC developers,

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 <[email protected]>

You can always tell a really good idea by the enemies it makes.
  --programmers' axiom


- --------------010807020804090006040905
Content-Type: text/x-diff;
 name=ackupPC_dump.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename=ackupPC_dump.patch"

- --- 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")



- --------------010807020804090006040905--


- --
Joachim Falk <[email protected]>

You can always tell a really good idea by the enemies it makes.
  --programmers' axiom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkotiFcACgkQ/BnjNq3zHnLDyQCfUtMAb6lOrpy3hSQBKWUP4UnR
le8An2XEYJehsTp9NPszxsyfWbiUdvm5
=PZfj
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
BackupPC-devel mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-devel
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.