Bugfix for BlackoutPeriods in BackupPC_dump
Joachim Falk <[email protected]>
| Newsgroups | gmane.comp.sysutils.backup.backuppc.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------010807020804090006040905
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable
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
--=20
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="BackupPC_dump.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
filename="BackupPC_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;
=20
foreach my $p ( @{$Conf{BlackoutPeriods}} ) {
+ # Don't clobber wday
+ my $matchWday =3D $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 t=
o
# Tuesday 0100, not Monday 2300-2400 plus Monday 0000-01=
00).
#
- $wday--;
- $wday +=3D 7 if ( $wday < 0 );
+ $matchWday--;
+ $matchWday +=3D 7 if ( $matchWday < 0 );
}
} else {
$blackout =3D $p->{hourBegin} <=3D $currHours
&& $currHours <=3D $p->{hourEnd};
}
- if ( $blackout && grep($_ =3D=3D $wday, @{$p->{weekDays}}) ) {
+ if ( $blackout && grep($_ =3D=3D $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--
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
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/
signature.asc
(application/pgp-signature, 260 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkosMIYACgkQ/BnjNq3zHnLNPwCdEF+oCnYvsoFCVvzs/IS4uLJF mMkAoLiIWzNCUvAvGdhQLwZBXMzxY6/k =Axm+ -----END PGP SIGNATURE-----