* BackupPC_Admin now uses $Conf{UmaskMode}, so config.pl files
authorcbarratt <cbarratt>
Mon, 22 Jan 2007 07:46:56 +0000 (07:46 +0000)
committercbarratt <cbarratt>
Mon, 22 Jan 2007 07:46:56 +0000 (07:46 +0000)
  written by the editor have more restrictive permissions.
  Reported by Tim Massey.

* Host summary now shows active backups on disabled hosts,
  from Jono Woodhouse.

* Fixed host LOG link and LOG list order, reported by Tim Massey.

* Moved Encode.pm version check to start of configure.pl so it
  produces a useful error message if Encode.pm is too old.

* Fixed hrefs to configuration documentation to handle changes
  in the way perl generates the anchors.  Reported by Philip
  Gleghorn.

* Host name links in LOG files now allow "." in the host name.
  Reported by Jean-Michel Beuken.

* Fixes to lib/BackupPC/Xfer/Tar.pm for tar 1.16: allow 1
  (ie: 256) as a successful exit status and match "Total
  bytes read" message for restores.  First reported by
  Torsten Sadowski and debugged by Ralf Gross and Holger
  Parplies.

13 files changed:
ChangeLog
conf/config.pl
configure.pl
doc-src/BackupPC.pod
lib/BackupPC/CGI/Browse.pm
lib/BackupPC/CGI/EditConfig.pm
lib/BackupPC/CGI/Lib.pm
lib/BackupPC/CGI/Summary.pm
lib/BackupPC/CGI/View.pm
lib/BackupPC/Config/Meta.pm
lib/BackupPC/Lib.pm
lib/BackupPC/Xfer/Tar.pm
makeDist

index 09c29ef..584231d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 # Version __VERSION__, __RELEASEDATE__
 #------------------------------------------------------------------------
 
+* BackupPC_Admin now uses $Conf{UmaskMode}, so config.pl files
+  written by the editor have more restrictive permissions.
+  Reported by Tim Massey.
+
+* Host summary now shows active backups on disabled hosts,
+  from Jono Woodhouse.
+
+* Fixed host LOG link and LOG list order, reported by Tim Massey.
+
+* Moved Encode.pm version check to start of configure.pl so it
+  produces a useful error message if Encode.pm is too old.
+
+* Fixed hrefs to configuration documentation to handle changes
+  in the way perl generates the anchors.  Reported by Philip
+  Gleghorn.
+
+* Host name links in LOG files now allow "." in the host name.
+  Reported by Jean-Michel Beuken.
+
+* Fixes to lib/BackupPC/Xfer/Tar.pm for tar 1.16: allow 1
+  (ie: 256) as a successful exit status and match "Total
+  bytes read" message for restores.  First reported by
+  Torsten Sadowski and debugged by Ralf Gross and Holger
+  Parplies.
+
+#------------------------------------------------------------------------
+# Version 3.0.0beta3, 3 Dec 2006
+#------------------------------------------------------------------------
+
 * Removed default paths from conf/config.pl so configure.pl will
   determine the correct ones at install time.  Avoids problem of
   the config editor complaining about bad executable paths the
index 9d0c276..9310157 100644 (file)
@@ -647,7 +647,7 @@ $Conf{ArchiveInfoKeepCnt} = 10;
 # the setting is assumed to apply all shares.
 #
 # If a hash is used, a special key "*" means it applies to all
-# shares.
+# shares that don't have a specific entry.
 #
 # Examples:
 #    $Conf{BackupFilesOnly} = '/myFiles';
@@ -697,7 +697,7 @@ $Conf{BackupFilesOnly} = undef;
 # followed by "/*", eg: "/proc/*", instead of just "/proc".
 #
 # If a hash is used, a special key "*" means it applies to all
-# shares.
+# shares that don't have a specific entry.
 #
 # Examples:
 #    $Conf{BackupFilesExclude} = '/temp';
@@ -2048,6 +2048,7 @@ $Conf{CgiUserConfigEdit} = {
         TarIncrArgs               => 1,
         TarClientCmd              => 0,
         TarClientRestoreCmd       => 0,
+        TarClientPath             => 0,
         RsyncShareName            => 1,
         RsyncdClientPort          => 1,
         RsyncdPasswd              => 1,
@@ -2057,6 +2058,7 @@ $Conf{CgiUserConfigEdit} = {
         RsyncRestoreArgs          => 1,
         RsyncClientCmd            => 0,
         RsyncClientRestoreCmd     => 0,
+        RsyncClientPath           => 0,
         ArchiveDest               => 1,
         ArchiveComp               => 1,
         ArchivePar                => 1,
index 03317be..e92963a 100755 (executable)
@@ -47,9 +47,18 @@ use strict;
 no  utf8;
 use vars qw(%Conf %OrigConf);
 use lib "./lib";
+use Encode;
+
+my $EncodeVersion = eval($Encode::VERSION);
+if ( $EncodeVersion < 1.99 ) {
+    print("Error: you need to upgrade perl's Encode package.\n"
+        . "I found $EncodeVersion and BackupPC needs >= 1.99\n"
+        . "Please go to www.cpan.org or use the cpan command.\n");
+    exit(1);
+}
 
 my @Packages = qw(File::Path File::Spec File::Copy DirHandle Digest::MD5
-                  Data::Dumper Getopt::Std Getopt::Long Encode Pod::Usage
+                  Data::Dumper Getopt::Std Getopt::Long Pod::Usage
                   BackupPC::Lib BackupPC::FileZIO);
 
 foreach my $pkg ( @Packages ) {
@@ -78,13 +87,6 @@ before installing BackupPC.
 EOF
 }
 
-my $EncodeVersion = eval($Encode::VERSION);
-if ( $EncodeVersion < 1.99 ) {
-    print("\nError: you need to upgrade the Encode package;"
-        . " I found $EncodeVersion and BackupPC needs >= 1.99\n\n");
-    exit(1);
-}
-
 my %opts;
 $opts{"set-perms"} = 1;
 if ( !GetOptions(
@@ -1180,7 +1182,7 @@ final locations.
 
 Use locations specified by the Filesystem Hierarchy Standard
 for installing BackupPC.  This is enabled by default for new
-installatios.  To use the pre-3.0 installation locations,
+installations.  To use the pre-3.0 installation locations,
 specify --no-fhs.
 
 =item B<--help|?>
index 741596d..849bfaf 100644 (file)
@@ -406,7 +406,7 @@ L<http://rsync.samba.org>. Use "rsync --version" to check your version.
 For BackupPC to use Rsync you will also need to install the perl
 File::RsyncP module, which is available from
 L<http://perlrsync.sourceforge.net>.
-Version 0.70 or later is required.
+Version 0.68 or later is required.
 
 =item *
 
index d9f4b8a..f02386c 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -65,7 +65,7 @@ sub action
     #
     # default to the newest backup
     #
-    if ( !defined($In{num}) && defined(@Backups) ) {
+    if ( !defined($In{num}) && defined(@Backups) && @Backups > 0 ) {
         $i = @Backups - 1;
         $num = $Backups[$i]{num};
     }
index 351f429..964374c 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 18 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -986,7 +986,7 @@ sub fieldEditBuild
     if ( $level == 0 ) {
         my $lcVarName = lc($varName);
        $content .= <<EOF;
-<tr><td class="border"><a href="?action=view&type=docs#item_%24conf%7b$lcVarName%7d">$varName</a>
+<tr><td class="border"><a href="?action=view&type=docs#item__conf_${lcVarName}_">$varName</a>
 EOF
        if ( defined($overrideVar) ) {
            my $override_checked = "";
index fe0aabe..b56fa63 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -102,11 +102,13 @@ sub NewRequest
        %Conf   = $bpc->Conf();
        $Lang   = $bpc->Lang();
        $ConfigMTime = $bpc->ConfigMTime();
+        umask($Conf{UmaskMode});
     } elsif ( $bpc->ConfigMTime() != $ConfigMTime ) {
         $bpc->ConfigRead();
         %Conf   = $bpc->Conf();
         $Lang   = $bpc->Lang();
         $ConfigMTime = $bpc->ConfigMTime();
+        umask($Conf{UmaskMode});
     }
 
     #
index 725e850..436cadf 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -109,9 +109,15 @@ sub action
        $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}}
                      || $Conf{CgiStatusHilightColor}{$Status{$host}{state}};
        if ( $Conf{BackupsDisable} == 1 ) {
-           $reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_OnlyManualBackups};
-           $tempState = "Disabled_OnlyManualBackups";
-           $tempReason = "";
+            if ( $Status{$host}{state} ne "Status_backup_in_progress"
+                    && $Status{$host}{state} ne "Status_restore_in_progress" ) {
+                $reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_OnlyManualBackups};
+                $tempState = "Disabled_OnlyManualBackups";
+                $tempReason = "";
+            } else {
+                $tempState = $Status{$host}{state};
+                $tempReason = $Status{$host}{reason};
+            }
        } elsif ($Conf{BackupsDisable} == 2 ) {
            $reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_AllBackupsDisabled};
            $tempState = "Disabled_AllBackupsDisabled";
index 335fde4..2ce291e 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -91,6 +91,7 @@ sub action
         if ( !defined($In{num}) ) {
             # get the latest LOG file
             $file = ($bpc->sortedPCLogFiles($host))[0];
+            $file =~ s/\.z$//;
         } else {
             $file = "$TopDir/pc/$host/LOG$ext";
         }
@@ -173,7 +174,7 @@ sub action
                    last if ( $s eq "" );
                    $s =~ s/[\n\r]+//g;
                    $s = ${EscHTML($s)};
-                   $s =~ s/\b([\w-]+)\b/defined($Hosts->{$1})
+                   $s =~ s/\b([\w-.]+)\b/defined($Hosts->{$1})
                                            ? ${HostLink($1)} : $1/eg;
                    $c .= $s . "\n";
                }
@@ -199,7 +200,7 @@ sub action
                    $s =~ s[(\$Conf\{.*?\})][
                        my $c = $1;
                        my $s = lc($c);
-                       $s =~ s{(\W)}{sprintf("%%%02x", ord($1) )}gxe;
+                       $s =~ s{(\W)}{_}g;
                        "<a href=\"?action=view&type=docs#item_$s\"><tt>$c</tt></a>"
                    ]eg;
                    $c .= $s . "\n";
index c33a443..e005d0e 100644 (file)
@@ -392,6 +392,7 @@ use vars qw(%ConfigMeta);
                 TarFullArgs               => "boolean",
                 TarIncrArgs               => "boolean",
                 TarClientCmd              => "boolean",
+                TarClientPath             => "boolean",
                 TarClientRestoreCmd       => "boolean",
                 RsyncShareName            => "boolean",
                 RsyncdClientPort          => "boolean",
@@ -401,6 +402,7 @@ use vars qw(%ConfigMeta);
                 RsyncArgs                 => "boolean",
                 RsyncRestoreArgs          => "boolean",
                 RsyncClientCmd            => "boolean",
+                RsyncClientPath           => "boolean",
                 RsyncClientRestoreCmd     => "boolean",
                 ArchiveDest               => "boolean",
                 ArchiveComp               => "boolean",
index 86a3b3f..faa66b1 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -94,7 +94,7 @@ sub new
 
     my $bpc = bless {
        %$paths,
-        Version => '3.0.0beta2',
+        Version => '3.0.0beta3',
     }, $class;
 
     $bpc->{storage} = BackupPC::Storage->new($paths);
@@ -1237,9 +1237,12 @@ sub compareLOGName
 
     if ( length($na) >= 5 && length($nb) >= 5 ) {
         #
-        # Both new style.  Bigger numbers are more recent.
+        # Both new style: format is MMYYYY.  Bigger dates are
+        # more recent.
         #
-        return $nb - $na;
+        my $ma = $2 * 12 + $1 if ( $na =~ /(\d+)(\d{4})/ );
+        my $mb = $2 * 12 + $1 if ( $nb =~ /(\d+)(\d{4})/ );
+        return $mb - $ma;
     } elsif ( length($na) >= 5 && length($nb) < 5 ) {
         return -1;
     } elsif ( length($na) < 5 && length($nb) >= 5 ) {
index 856d1b7..8cc2c0f 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0beta2, released 11 Nov 2006.
+# Version 3.0.0beta3, released 3 Dec 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -210,7 +210,12 @@ sub readOutput
         my $mesg;
         if ( sysread($t->{pipeTar}, $mesg, 8192) <= 0 ) {
             vec($$FDreadRef, fileno($t->{pipeTar}), 1) = 0;
-           if ( !close($t->{pipeTar}) ) {
+            if ( !close($t->{pipeTar}) && $? != 256 ) {
+                #
+                # Tar 1.16 uses exit status 1 (256) when some files
+                # changed during archive creation.  We allow this
+                # as a benign error and consider the archive ok
+                #
                $t->{tarOut} .= "Tar exited with error $? ($!) status\n";
                $t->{xferOK} = 0 if ( !$t->{tarBadExitOk} );
            }
@@ -229,7 +234,7 @@ sub readOutput
         #
         alarm($conf->{ClientTimeout}) if ( !$t->{abort} );
         $t->{lastOutputLine} = $_ if ( !/^$/ );
-        if ( /^Total bytes written: / ) {
+        if ( /^Total bytes (written|read): / ) {
             $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
             $t->{xferOK} = 1;
         } elsif ( /^\./ ) {
index b8f4361..ec18f44 100755 (executable)
--- a/makeDist
+++ b/makeDist
@@ -53,8 +53,8 @@ die("BackupPC::Lib->new failed\n")
 
 umask(0022);
 
-my $Version     = "3.0.0beta3";
-my $ReleaseDate = "3 Dec 2006";
+my $Version     = "3.0.0";
+my $ReleaseDate = "21 Jan 2007";
 my $DistDir     = "dist/BackupPC-$Version";
 
 my @PerlSrc = qw(
@@ -270,24 +270,15 @@ sub InstallFile
            s/__RELEASEDATE__/$ReleaseDate/g;
            if ( $file =~ /BackupPC\.html$/ ) {
                #
-               # fixup for perl 5.6.x
+               # fixup for conf links
                #
-               if ( !/A NAME="item_(%|_)24Conf/i ) {
+               if ( !/A NAME="item_(%|_)conf/i ) {
                    s/\$Conf{([^}]*)}/
                        defined($ConfName{$1})
-                           ? "\L<A HREF=\"#$ConfName{$1}\">\E\$Conf{$1}<\/A>"
+                           ? "\L<a href=\"#$ConfName{$1}\">\E\$Conf{$1}<\/A>"
                            : "\$Conf{$1}"/eg;
                }
-               s/<(A NAME="item_(%|_)24Conf(%|_)7B(.*?)(%|_)7D).*?">/\L<A NAME="item_%24Conf%7b$4%7d">/ig;
                s/^<DD>/<DD><P>/;
-               #
-               # Fixup for perl 5.8.x first one no longer needed after
-               # fix in CSS)
-               #
-#              if ( /^<\/dt>/ ) {
-#                  $_ .= <FILE>;
-#                  s/^(<\/dt>\n<dd>)/$1<p>/s;
-#              }
                s/^<li><\/li>/<li>/;
            }
            if ( /__CONFIGPOD__/ ) {
@@ -356,10 +347,8 @@ sub config2pod
                 s/([^;])\s*$/$1 .../;
             }
             push(@conf, $_);
-            my $text = "\$Conf{$var}";
-            $text =~ s/\s+/_/sg;
-            $text =~ s{(\W)}{sprintf("%%%02X", ord($1) )}gxe;
-            $text = substr($text, 0, 50);
+            my $text = "_conf_${var}_";
+            $text =~ s{[\W\s]}{_}g;
             $ConfName{$var} = "item_$text";
         } elsif ( /^$/ ) {
             if ( $str ne "" && @conf ) {