Changes for 3.1.0beta0.
authorcbarratt <cbarratt>
Mon, 3 Sep 2007 17:19:53 +0000 (17:19 +0000)
committercbarratt <cbarratt>
Mon, 3 Sep 2007 17:19:53 +0000 (17:19 +0000)
* Added new script BackupPC_archiveStart that allows command-line
  starting of archives.  Based on script written by Sergey Kovzik,
  which in turn was based on an earlier version by Holger Parplies.

* Added check to BackupPC at startup that $TopDir can support
  hardlinks. Also added check to BackupPC_dump that a hardlink
  below $TopDir/pc/HOST can be made to below $TopDir/cpool.
  Also added the need for a hard-link capable file system to
  the documentation.  Suggested by Nils Breunese.

* Made the default charset for BackupPC_zipCreate cp1252, which
  appears to work correctly with WinZip.  Unfortunately there is
  no clear standard for charset encoding in zip files.

* Added support so that pre-3.0 backups with non-utf8 charsets
  can be viewed and restored correctly.  A new config variable
  $Conf{ClientCharsetLegacy} specifies the charset used to
  encode file names in legacy backups.  This is only relevant
  if you are trying to view or restore a backup made with
  BackupPC 2.x and some of the file names have non-ascii
  characters.

* Added setting of the environment variable BPC_REQUSER to
  the requesting user name in BackupPC prior to fork(), so
  each child process inherits the value.  Submitted by
  Holger Parplies.

* Fixed bug in rsync incrementals that happens on particular
  file names when a file being backed up fails in both rsync
  phases.  Reported by Dan Smisko.

* Removed ConfDir from config editor (since it is hardcoded in
  lib/BackupPC/Lib.pm).  Also made TopDir and LogDir only visible
  if useFHS (for non-FHS they are hardcoded in lib/BackupPC/Lib.pm).

64 files changed:
ChangeLog
bin/BackupPC
bin/BackupPC_archive
bin/BackupPC_archiveHost
bin/BackupPC_archiveStart
bin/BackupPC_attribPrint
bin/BackupPC_compressPool
bin/BackupPC_dump
bin/BackupPC_fixupBackupSummary
bin/BackupPC_link
bin/BackupPC_nightly
bin/BackupPC_restore
bin/BackupPC_sendEmail
bin/BackupPC_serverMesg
bin/BackupPC_tarCreate
bin/BackupPC_tarExtract
bin/BackupPC_tarPCCopy
bin/BackupPC_trashClean
bin/BackupPC_zcat
bin/BackupPC_zipCreate
cgi-bin/BackupPC_Admin
conf/config.pl
configure.pl
doc-src/BackupPC.pod
lib/BackupPC/Attrib.pm
lib/BackupPC/CGI/AdminOptions.pm
lib/BackupPC/CGI/Archive.pm
lib/BackupPC/CGI/ArchiveInfo.pm
lib/BackupPC/CGI/Browse.pm
lib/BackupPC/CGI/DirHistory.pm
lib/BackupPC/CGI/EditConfig.pm
lib/BackupPC/CGI/EmailSummary.pm
lib/BackupPC/CGI/GeneralInfo.pm
lib/BackupPC/CGI/HostInfo.pm
lib/BackupPC/CGI/LOGlist.pm
lib/BackupPC/CGI/Lib.pm
lib/BackupPC/CGI/Queue.pm
lib/BackupPC/CGI/RSS.pm
lib/BackupPC/CGI/ReloadServer.pm
lib/BackupPC/CGI/Restore.pm
lib/BackupPC/CGI/RestoreFile.pm
lib/BackupPC/CGI/RestoreInfo.pm
lib/BackupPC/CGI/StartServer.pm
lib/BackupPC/CGI/StartStopBackup.pm
lib/BackupPC/CGI/StopServer.pm
lib/BackupPC/CGI/Summary.pm
lib/BackupPC/CGI/View.pm
lib/BackupPC/Config/Meta.pm
lib/BackupPC/FileZIO.pm
lib/BackupPC/Lang/zh_CN.pm
lib/BackupPC/Lib.pm
lib/BackupPC/PoolWrite.pm
lib/BackupPC/Storage.pm
lib/BackupPC/Storage/Text.pm
lib/BackupPC/View.pm
lib/BackupPC/Xfer/Archive.pm
lib/BackupPC/Xfer/BackupPCd.pm
lib/BackupPC/Xfer/Rsync.pm
lib/BackupPC/Xfer/RsyncDigest.pm
lib/BackupPC/Xfer/RsyncFileIO.pm
lib/BackupPC/Xfer/Smb.pm
lib/BackupPC/Xfer/Tar.pm
lib/BackupPC/Zip/FileMember.pm
makeDist

index f184c6f..742d05b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 # Version __VERSION__, __RELEASEDATE__
 #------------------------------------------------------------------------
 
-* Added some performance improvements to BackupPC::Xfer::RsyncFileIO
-  for the case of small files with cached checksums.
+* Added new script BackupPC_archiveStart that allows command-line
+  starting of archives.  Based on script written by Sergey Kovzik,
+  which in turn was based on an earlier version by Holger Parplies.
+
+* Added Simplified Chinese CGI translation from Youlin Feng,
+  plus fixed a couple of cases where utf8 share names were
+  not displayed correctly.
+
+* Added sorting by column feature to host summary table in CGI
+  interface.  Implemented by Jeremy Tietsort.
 
 * Added optional support for IO::Dirent which allows inode information
   to be extracted from the dirent directory structure.  This allows
   gain.  On other file systems there is no real improvement.  This
   optimization is turned on automatically if IO::Dirent is installed.
 
-* Added sorting by column feature to host summary table in CGI
-  interface.  Implemented by Jeremy Tietsort.
+* Added some performance improvements to BackupPC::Xfer::RsyncFileIO
+  for the case of small files with cached checksums.
 
-* Added Simplified Chinese CGI translation from Youlin Feng.
+* Added check to BackupPC at startup that $TopDir can support
+  hardlinks. Also added check to BackupPC_dump that a hardlink
+  below $TopDir/pc/HOST can be made to below $TopDir/cpool.
+  Also added the need for a hard-link capable file system to
+  the documentation.  Suggested by Nils Breunese.
 
 * Added FreeBSD init.d file provided by Gabriel Rossetti.
 
   provide a file list (without creating the archive).
   Requested by Dirk.
 
+* Made the default charset for BackupPC_zipCreate cp1252, which
+  appears to work correctly with WinZip.  Unfortunately there is
+  no clear standard for charset encoding in zip files.
+
+* Added support so that pre-3.0 backups with non-utf8 charsets
+  can be viewed and restored correctly.  A new config variable
+  $Conf{ClientCharsetLegacy} specifies the charset used to
+  encode file names in legacy backups.  This is only relevant
+  if you are trying to view or restore a backup made with
+  BackupPC 2.x and some of the file names have non-ascii
+  characters.
+
+* Added setting of the environment variable BPC_REQUSER to
+  the requesting user name in BackupPC prior to fork(), so
+  each child process inherits the value.  Submitted by
+  Holger Parplies.
+
+* Fixed bug in rsync incrementals that happens on particular
+  file names when a file being backed up fails in both rsync
+  phases.  Reported by Dan Smisko.
+
 * Fixed single-restore file name charsets for IE, reported by
   Francis Lessard.
 
 * Fixed makeDist so that the --config-dir option to configure.pl
   works correctly.  Reported by Randy Barlow, Tony Shadwick and others.
 
+* Removed ConfDir from config editor (since it is hardcoded in
+  lib/BackupPC/Lib.pm).  Also made TopDir and LogDir only visible
+  if useFHS (for non-FHS they are hardcoded in lib/BackupPC/Lib.pm).
+
 * Applied patch from Holger Parplies that fixes cleanup of early abort
   in BackupPC_dump.
 
index 2053aa5..ae8e918 100755 (executable)
@@ -47,7 +47,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -59,7 +59,7 @@ use vars qw(%Status %Info $Hosts);
 use lib "/usr/local/BackupPC/lib";
 use BackupPC::Lib;
 use BackupPC::FileZIO;
-use Encode;
+use Encode qw/decode_utf8/;
 
 use File::Path;
 use Data::Dumper;
@@ -248,14 +248,16 @@ sub Main_Initialize
     umask($Conf{UmaskMode});
 
     #
-    # Check for another running process, check that PASSWD is set and
-    # verify executables are configured correctly.
+    # Check for another running process, verify executables are configured
+    # correctly and make sure $TopDir is on a file system that supports
+    # hardlinks.
     #
     if ( $Info{pid} ne "" && kill(0, $Info{pid}) ) {
         print(STDERR $bpc->timeStamp,
                  "Another BackupPC is running (pid $Info{pid}); quitting...\n");
         exit(1);
     }
+
     foreach my $progName ( qw(SmbClientPath NmbLookupPath PingPath DfPath
                               SendmailPath SshPath) ) {
         next if ( $Conf{$progName} eq "" || -x $Conf{$progName} );
@@ -265,6 +267,17 @@ sub Main_Initialize
         exit(1);
     }
 
+    if ( !$bpc->HardlinkTest("$TopDir/pc", "$TopDir/cpool") ) {
+        print(STDERR $bpc->timeStamp, "Can't create a test hardlink between a file"
+                   . " in $TopDir/pc and $TopDir/cpool.  Either these are different"
+                   . " file systems, or this file system doesn't support hardlinks,"
+                   . " or these directories don't exist, or there is a permissions"
+                   . " problem, or the file system is out of inodes or full.  Use"
+                   . " df, df -i, and ls -ld to check each of these possibilities."  
+                   . " Quitting...\n");
+        exit(1);
+    }
+
     if ( $opts{d} ) {
         #
         # daemonize by forking; more robust method per:
@@ -522,6 +535,7 @@ sub Main_TryToRun_CmdQueue
         }
         if ( !$pid ) {
             setpgrp 0,0;
+            $ENV{BPC_REQUSER} = $req->{user};
             exec(@$cmd);
             print(LOG $bpc->timeStamp, "can't exec @$cmd for $host\n");
             exit(0);
@@ -1576,10 +1590,7 @@ sub StatusWrite
              [  \%Info, \%Status],
              [qw(*Info   *Status)]);
     $dump->Indent(1);
-    if ( open(STATUS, ">", "$LogDir/status.pl") ) {
-        print(STATUS $dump->Dump);
-        close(STATUS);
-    }
+    $bpc->{storage}->TextFileWrite("$LogDir/status.pl", $dump->Dump);
 }
 
 #
index a2265c4..246c12a 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 8e6c483..eefa236 100755 (executable)
@@ -38,7 +38,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 54ec76a..09ed23e 100755 (executable)
@@ -35,7 +35,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 53c2f72..8fcf821 100755 (executable)
@@ -31,7 +31,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index e11a611..dddccce 100755 (executable)
@@ -49,7 +49,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index d0925f0..8da28c3 100755 (executable)
@@ -70,7 +70,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -388,7 +388,6 @@ my(@lastIdxByLevel, $incrCntSinceFull);
 # as a starting point for an incremental.
 #
 @Backups = $bpc->BackupInfoRead($client);
-## @Backups = sort( { $a->{startTime} <=> $b->{startTime} }, @Backups);
 for ( my $i = 0 ; $i < @Backups ; $i++ ) {
     $needLink = 1 if ( $Backups[$i]{nFilesNew} eq ""
                         || -f "$Dir/NewFileList.$Backups[$i]{num}" );
@@ -457,6 +456,19 @@ if ( @Backups == 0
     NothingToDo($needLink);
 }
 
+if ( !$bpc->HardlinkTest($Dir, "$TopDir/cpool") ) {
+    print(LOG $bpc->timeStamp, "Can't create a test hardlink between a file"
+               . " in $Dir and $TopDir/cpool.  Either these are different"
+               . " file systems, or this file system doesn't support hardlinks,"
+               . " or these directories don't exist, or there is a permissions"
+               . " problem, or the file system is out of inodes or full.  Use"
+               . " df, df -i, and ls -ld to check each of these possibilities."
+               . " Quitting...\n");
+    print("test hardlink between $Dir and $TopDir/cpool failed\n");
+    print("link $clientURI\n") if ( $needLink );
+    exit(1);
+}
+
 #
 # Check if $host is alive
 #
@@ -908,6 +920,15 @@ if ( $type eq "full" && $stat{hostError} eq ""
 
 $stat{xferOK} = 0 if ( $Abort );
 
+#
+# If there is no "new" directory then the backup is bad
+#
+if ( $stat{xferOK} && !-d "$Dir/new" ) {
+    $stat{hostError} = "No backup directory $Dir/new"
+                            if ( $stat{hostError} eq "" );
+    $stat{xferOK} = 0;
+}
+
 #
 # Do one last check to make sure it is still the machine we expect.
 #
@@ -1379,6 +1400,7 @@ sub BackupSave
     # (the new backup might also be a partial, but that's ok).
     #
     BackupPartialRemove($client, \@Backups);
+    $needLink = 1 if ( -f "$Dir/NewFileList" );
 
     #
     # Number the new backup
@@ -1391,8 +1413,8 @@ sub BackupSave
     if ( !rename("$Dir/new", "$Dir/$num") ) {
         print(LOG $bpc->timeStamp, "Rename $Dir/new -> $Dir/$num failed\n");
         $stat{xferOK} = 0;
+        return;
     }
-    $needLink = 1 if ( -f "$Dir/NewFileList" );
 
     #
     # Add the new backup information to the backup file
index 2b308b4..67210d7 100755 (executable)
@@ -30,7 +30,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index d05b61c..2528c17 100755 (executable)
@@ -39,7 +39,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 22782d1..a31332c 100755 (executable)
@@ -55,7 +55,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 81eefaa..046390d 100755 (executable)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index d826893..4b0b055 100755 (executable)
@@ -31,7 +31,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 4fe7c20..7b92139 100755 (executable)
@@ -43,7 +43,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 5548672..662a3be 100755 (executable)
@@ -55,7 +55,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -94,6 +94,8 @@ usage: $0 [options] files/directories...
      -w writeBufSz   write buffer size (default 1048576 = 1MB)
      -e charset      charset for encoding file names (default: value of
                      \$Conf{ClientCharset} when backup was done)
+     -l              just print a file listing; don't generate an archive
+     -L              just print a detailed file listing; don't generate an archive
 EOF
     exit(1);
 }
index 4043bf0..5f14508 100755 (executable)
@@ -27,7 +27,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index b5194d3..62f0a94 100755 (executable)
@@ -38,7 +38,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index c3c2d0c..6d144b3 100755 (executable)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 13c5da1..a08f3ed 100755 (executable)
@@ -32,7 +32,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index cb13b2f..f42690f 100755 (executable)
@@ -21,8 +21,7 @@
 #       -r pathRemove   path prefix that will be replaced with pathAdd
 #       -p pathAdd      new path prefix
 #       -c level        compression level (default is 0, no compression)
-#       -e charset      charset for encoding file names (default: value of
-#                       $Conf{ClientCharset} when backup was done)
+#       -e charset      charset for encoding file names (default: cp1252)
 #
 #     The -h, -n and -s options specify which dump is used to generate
 #     the zip archive.  The -r and -p options can be used to relocate
@@ -52,7 +51,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -94,8 +93,7 @@ usage: $0 [options] files/directories...
      -r pathRemove   path prefix that will be replaced with pathAdd
      -p pathAdd      new path prefix
      -c level        compression level (default is 0, no compression)
-     -e charset      charset for encoding file names (default: value of
-                     \$Conf{ClientCharset} when backup was done)
+     -e charset      charset for encoding file names (default: cp1252)
 EOF
     exit(1);
 }
@@ -137,7 +135,7 @@ if ( $i >= @Backups ) {
     exit(1);
 }
 
-my $Charset = $Backups[$i]{charset};
+my $Charset = "cp1252";
 $Charset = $opts{e} if ( $opts{e} ne "" );
 
 my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ );
index 79e66fe..a53f805 100755 (executable)
@@ -39,7 +39,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index fd78dfc..461e3f8 100644 (file)
@@ -868,6 +868,17 @@ $Conf{XferLogLevel} = 1;
 #
 $Conf{ClientCharset} = '';
 
+#
+# Prior to 3.x no charset conversion was done by BackupPC.  Backups were
+# stored in what ever charset the XferMethod provided - typically utf8
+# for smbclient and the client's locale settings for rsync and tar (eg:
+# cp1252 for rsync on WinXX and perhaps iso-8859-1 with rsync on linux).
+# This setting tells BackupPC the charset that was used to store file
+# names in old backups taken with BackupPC 2.x, so that non-ascii file
+# names in old backups can be viewed and restored.
+#
+$Conf{ClientCharsetLegacy} = 'iso-8859-1';
+
 #
 # Name of the host share that is backed up when using SMB.  This can be a
 # string or an array of strings if there are multiple shares per host.
@@ -2034,6 +2045,7 @@ $Conf{CgiUserConfigEdit} = {
         BlackoutPeriods           => 1,
         BackupZeroFilesIsFatal    => 1,
         ClientCharset             => 1,
+        ClientCharsetLegacy       => 1,
         XferMethod                => 1,
         XferLogLevel              => 1,
         SmbShareName              => 1,
index 0e5a0df..e604ac1 100755 (executable)
@@ -474,7 +474,7 @@ if ( $Conf{CgiDir} ne "" ) {
 
 BackupPC's CGI script needs to display various GIF images that
 should be stored where Apache can serve them.  They should be
-placed somewher under Apache's DocumentRoot.  BackupPC also
+placed somewhere under Apache's DocumentRoot.  BackupPC also
 needs to know the URL to access these images.  Example:
 
     Apache image directory:  /usr/local/apache/htdocs/BackupPC
index 60f5b01..457f682 100644 (file)
@@ -415,6 +415,28 @@ with mod_perl support.
 
 =back
 
+=head2 What type of storage space do I need?
+
+BackupPC uses hardlinks to pool files common to different backups.
+Therefore BackupPC's data store (__TOPDIR__) must point to a single
+file system that supports hardlinks.  You cannot split this file
+system with multiple mount points or using symbolic links to point a
+sub-directory to a different file system (it is ok to use a single
+symbolic link at the top-level directory (__TOPDIR__) to point the
+entire data store somewhere else).  You can of course use any kind of
+RAID system or logical volume manager that combines the capacity of
+multiple disks into a single, larger, file system. Such approaches
+have the advantage that the file system can be expanded without having
+to copy it.
+
+Any standard linux or unix file system supports hardlinks.  NFS mounted
+file systems work too (provided the underlying file system supports
+hardlinks).  But windows based FAT and NTFS file systems will not work.
+
+Starting with BackupPC 3.1.0, run-time checks are done at startup and
+at the start of each backup to ensure that the file system can support
+hardlinks, since this is a common area of configuration problems.
+
 =head2 How much disk space do I need?
 
 Here's one real example for an environment that is backing up 65 laptops
@@ -1618,59 +1640,28 @@ incremental or full backup.
 
 The usage is:
 
-   BackupPC_tarCreate [-t] [-h host] [-n dumpNum] [-s shareName]
-                   [-r pathRemove] [-p pathAdd] [-b BLOCKS] [-w writeBufSz]
-                    files/directories...
+    BackupPC_tarCreate [options] files/directories...
+    Required options:
+       -h host         host from which the tar archive is created
+       -n dumpNum      dump number from which the tar archive is created
+                       A negative number means relative to the end (eg -1
+                       means the most recent dump, -2 2nd most recent etc).
+       -s shareName    share name from which the tar archive is created
+  
+    Other options:
+       -t              print summary totals
+       -r pathRemove   path prefix that will be replaced with pathAdd
+       -p pathAdd      new path prefix
+       -b BLOCKS       BLOCKS x 512 bytes per record (default 20; same as tar)
+       -w writeBufSz   write buffer size (default 1048576 = 1MB)
+       -e charset      charset for encoding file names (default: value of
+                       $Conf{ClientCharset} when backup was done)
+       -l              just print a file listing; don't generate an archive
+       -L              just print a detailed file listing; don't generate an archive
 
 The command-line files and directories are relative to the specified
 shareName.  The tar file is written to stdout.
 
-The required options are:
-
-=over 4
-
-=item -h host
-
-host from which the tar archive is created
-
-=item -n dumpNum
-
-dump number from which the tar archive is created
-
-=item -s shareName
-
-share name from which the tar archive is created
-
-=back
-
-Other options are:
-
-=over 4
-
-=item -t
-
-print summary totals
-
-=item -r pathRemove
-
-path prefix that will be replaced with pathAdd
-
-=item -p pathAdd
-
-new path prefix
-
-=item -b BLOCKS
-
-the tar block size, default is 20, meaning tar writes data in 20 * 512
-bytes chunks.
-
-=item -w writeBufSz
-
-write buffer size, default 1048576 (1MB).  You can increase this if
-you are trying to stream to a fast tape device.
-
-=back
-
 The -h, -n and -s options specify which dump is used to generate
 the tar archive.  The -r and -p options can be used to relocate
 the paths in the tar archive so extracted files can be placed
@@ -1685,57 +1676,27 @@ incremental or full backup.
 
 The usage is:
 
-   BackupPC_zipCreate [-t] [-h host] [-n dumpNum] [-s shareName]
-                   [-r pathRemove] [-p pathAdd] [-c compressionLevel]
-                   files/directories...
+    BackupPC_zipCreate [options] files/directories...
+    Required options:
+       -h host         host from which the zip archive is created
+       -n dumpNum      dump number from which the tar archive is created
+                       A negative number means relative to the end (eg -1
+                       means the most recent dump, -2 2nd most recent etc).
+       -s shareName    share name from which the zip archive is created
+  
+    Other options:
+       -t              print summary totals
+       -r pathRemove   path prefix that will be replaced with pathAdd
+       -p pathAdd      new path prefix
+       -c level        compression level (default is 0, no compression)
+       -e charset      charset for encoding file names (default: cp1252)
 
 The command-line files and directories are relative to the specified
-shareName.  The zip file is written to stdout.
-
-The required options are:
-
-=over 4
-
-=item -h host
-
-host from which the zip archive is created
-
-=item -n dumpNum
-
-dump number from which the zip archive is created
-
-=item -s shareName
-
-share name from which the zip archive is created
-
-=back
-
-Other options are:
-
-=over 4
-
-=item -t
-
-print summary totals
-
-=item -r pathRemove
-
-path prefix that will be replaced with pathAdd
-
-=item -p pathAdd
-
-new path prefix
-
-=item -c level
-
-compression level (default is 0, no compression)
-
-=back
-
-The -h, -n and -s options specify which dump is used to generate
-the zip archive.  The -r and -p options can be used to relocate
-the paths in the zip archive so extracted files can be placed
-in a location different from their original location.
+shareName.  The zip file is written to stdout. The -h, -n and -s
+options specify which dump is used to generate the zip archive.  The
+-r and -p options can be used to relocate the paths in the zip archive
+so extracted files can be placed in a location different from their
+original location.
 
 =back
 
@@ -1794,6 +1755,17 @@ The next screen allows you to adjust the parameters for this archive run.
 Press the "Start the Archive" to start archiving the selected hosts with the
 parameters displayed.
 
+=head2 Starting an Archive from the command line
+
+The script BackupPC_archiveStart can be used to start an archive from
+the command line (or cron etc).  The usage is:
+
+    BackupPC_archiveStart archiveHost userName hosts...
+
+This creates an archive of the most recent backup of each of
+the specified hosts.  The first two arguments are the archive
+host and the user name making the request.
+
 =head1 Other CGI Functions
 
 =head2 Configuration and Host Editor
index 2a76244..1c0e2a9 100644 (file)
@@ -30,7 +30,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -43,7 +43,7 @@ use strict;
 use Carp;
 use File::Path;
 use BackupPC::FileZIO;
-use Encode;
+use Encode qw/from_to/;
 require Exporter;
 
 use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS );
@@ -243,6 +243,7 @@ sub read
            }
        }
        (my $fileName, $data) = unpack("a$len a*", $data);
+
         from_to($fileName, $a->{charsetLegacy}, "utf8")
                         if ( $a->{charsetLegacy} ne "" );
        my $nFldsW = @FldsUnixW;
index e143a60..8eb2fbf 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index d837d3a..2851a78 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index c2e209e..6960c00 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 6e927f9..c49eae3 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -37,7 +37,7 @@
 package BackupPC::CGI::Browse;
 
 use strict;
-use Encode;
+use Encode qw/decode_utf8/;
 use BackupPC::CGI::Lib qw(:all);
 use BackupPC::View;
 use BackupPC::Attrib qw(:all);
@@ -301,7 +301,8 @@ EOF
         }
         $filledBackup .= eval("qq{$Lang->{Visit_this_directory_in_backup}}");
     }
-    $dir = decode_utf8($dir);
+    $dir   = decode_utf8($dir);
+    $share = decode_utf8($share);
     my $content = eval("qq{$Lang->{Backup_browse_for__host}}");
     Header(eval("qq{$Lang->{Browse_backup__num_for__host}}"), $content);
     Trailer();
index 5abcc36..1e374af 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 4811f4e..fbf97f9 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -93,11 +93,21 @@ our %ConfigMenu = (
            {name => "Bzip2Path"},
 
             {text => "CfgEdit_Title_Install_Paths"},
-            {name => "TopDir"},
-            {name => "ConfDir"},
-            {name => "LogDir"},
+            #
+            # Can only edit TopDir and LogDir if we are in FHS mode.
+            # Otherwise they are hardcoded in lib/BackupPC/Lib.pm.
+            #
+            {name => "TopDir",
+                    visible => sub { return $_[1]->useFHS(); } },
+            {name => "LogDir",
+                    visible => sub { return $_[1]->useFHS(); } },
            {name => "CgiDir"},
-           {name => "InstallDir"},
+            #
+            # Cannot edit ConfDir or InstallDir, since the real value is hardcoded in
+            # lib/BackupPC/Lib.pm.
+            # {name => "ConfDir"},
+           # {name => "InstallDir"},
+            #
         ],
     },
     email => {
@@ -161,6 +171,7 @@ our %ConfigMenu = (
             {name => "XferMethod", onchangeSubmit => 1},
             {name => "XferLogLevel"},
             {name => "ClientCharset"},
+            {name => "ClientCharsetLegacy"},
 
             {text => "CfgEdit_Title_Smb_Settings",
                 visible => sub { return $_[0]->{XferMethod} eq "smb"; } },
@@ -758,7 +769,7 @@ EOF
 
         next if ( $disabled || $menuDisable{$menu}{top} );
         if ( ref($paramInfo->{visible}) eq "CODE"
-                        && !&{$paramInfo->{visible}}($newConf) ) {
+                        && !&{$paramInfo->{visible}}($newConf, $bpc) ) {
             next;
         }
 
index 4871136..8a5304f 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 5bcea31..dbd74f6 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 3331be3..e95ffee 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index f148ff2..e71c7f1 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 8370b46..3ba992b 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index dfccc1f..f31f3be 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 346fc80..8c90bd6 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 8e6db27..3878ead 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index c9eec48..7fe7a5b 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -40,7 +40,7 @@ use strict;
 use BackupPC::CGI::Lib qw(:all);
 use Data::Dumper;
 use File::Path;
-use Encode;
+use Encode qw/decode_utf8/;
 
 sub action
 {
@@ -80,7 +80,7 @@ EOF
 EOF
     }
     $hiddenStr .= "<input type=\"hidden\" name=\"fcbMax\" value=\"$In{fcbMax}\">\n";
-    $hiddenStr .= "<input type=\"hidden\" name=\"share\" value=\"${EscHTML($share)}\">\n";
+    $hiddenStr .= "<input type=\"hidden\" name=\"share\" value=\"${EscHTML(decode_utf8($share))}\">\n";
     $badFileCnt++ if ( $In{pathHdr} =~ m{(^|/)\.\.(/|$)} );
     $badFileCnt++ if ( $In{num} =~ m{(^|/)\.\.(/|$)} );
     if ( @fileList == 0 ) {
@@ -113,7 +113,8 @@ EOF
         # Tell the user what options they have
         #
         $pathHdr = decode_utf8($pathHdr);
-       $content .= eval("qq{$Lang->{Restore_Options_for__host2}}");
+        $share   = decode_utf8($share);
+       $content = eval("qq{$Lang->{Restore_Options_for__host2}}");
 
         if ( @hosts == 1 ) {
             #
index 2a726d2..eebf67a 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -41,7 +41,7 @@ use BackupPC::CGI::Lib qw(:all);
 use BackupPC::FileZIO;
 use BackupPC::Attrib qw(:all);
 use BackupPC::View;
-use Encode qw/from_to/;
+use Encode qw/from_to decode_utf8/;
 
 sub action
 {
@@ -157,6 +157,10 @@ sub restoreFile
         ErrorExit("Can't restore bad file ${EscHTML($dir)} ($num, $share)");
     }
     my $f = BackupPC::FileZIO->open($a->{fullPath}, 0, $a->{compress});
+    if ( !defined($f) ) {
+        my $fullPath = decode_utf8($a->{fullPath});
+        ErrorExit("Unable to open file ${EscHTML($fullPath)} ($num, $share)");
+    }
     my $data;
     if ( !$skipHardLink && $a->{type} == BPC_FTYPE_HARDLINK ) {
        #
@@ -182,7 +186,8 @@ sub restoreFile
     print "Content-Type: $contentType\n";
     print "Content-Transfer-Encoding: binary\n";
 
-    if ( $ENV{HTTP_USER_AGENT} =~ /\bmsie\b/i ) {
+    if ( $ENV{HTTP_USER_AGENT} =~ /\bmsie\b/i
+                && $ENV{HTTP_USER_AGENT} !~ /\bopera\b/i ) {
         #
         # Convert to cp1252 for MS IE.  TODO: find a way to get IE
         # to accept UTF8 encoding.  Firefox accepts inline encoding
index ac7bad5..fb25a12 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -38,7 +38,7 @@ package BackupPC::CGI::RestoreInfo;
 
 use strict;
 use BackupPC::CGI::Lib qw(:all);
-use Encode;
+use Encode qw/decode_utf8/;
 
 sub action
 {
@@ -89,6 +89,8 @@ sub action
 <tr><td>$RestoreReq{hostSrc}:/$strippedShareSrc$f</td><td>$RestoreReq{hostDest}:/$strippedShareDest$targetFile</td></tr>
 EOF
     }
+    $RestoreReq{shareSrc}  = decode_utf8($RestoreReq{shareSrc});
+    $RestoreReq{shareDest} = decode_utf8($RestoreReq{shareDest});
     my $content = eval("qq{$Lang->{Restore___num_details_for__host2}}");
     Header(eval("qq{$Lang->{Restore___num_details_for__host}}"),$content);
     Trailer();
index acff95f..8e4dd74 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 697bd0e..8846405 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index e3f46dd..0462106 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 9b26188..f514d0c 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index ab797e9..02074e2 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index f21df2d..735c41d 100644 (file)
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -199,6 +199,7 @@ use vars qw(%ConfigMeta);
     XferLogLevel       => "integer",
 
     ClientCharset       => "string",
+    ClientCharsetLegacy => "string",
 
     SmbShareName       => {
            type   => "list",
@@ -382,6 +383,7 @@ use vars qw(%ConfigMeta);
                 XferMethod                => "boolean",
                 XferLogLevel              => "boolean",
                 ClientCharset             => "boolean",
+                ClientCharsetLegacy       => "boolean",
                 SmbShareName              => "boolean",
                 SmbShareUserName          => "boolean",
                 SmbSharePasswd            => "boolean",
index 294579a..0cf2a9f 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 4feb292..a7e6a77 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/bin/perl
 
 #my %lang;
 #use strict;
index e1dda82..88db7f8 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -49,7 +49,7 @@ use Socket;
 use Cwd;
 use Digest::MD5;
 use Config;
-use Encode;
+use Encode qw/from_to encode_utf8/;
 
 use vars qw( $IODirentOk );
 use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -115,7 +115,7 @@ sub new
             useFHS     => $useFHS,
             TopDir     => $topDir,
             InstallDir => $installDir,
-            ConfDir    => $confDir eq "" ? '/etc/BackupPC' : $confDir,
+            ConfDir    => $confDir eq "" ? '/tera0/backup/BackupPC/conf' : $confDir,
             LogDir     => '/var/log/BackupPC',
         };
     } else {
@@ -130,7 +130,7 @@ sub new
 
     my $bpc = bless {
        %$paths,
-        Version => '3.0.0',
+        Version => '3.1.0beta0',
     }, $class;
 
     $bpc->{storage} = BackupPC::Storage->new($paths);
@@ -886,6 +886,33 @@ sub MakeFileLink
     }
 }
 
+#
+# Tests if we can create a hardlink from a file in directory
+# $newDir to a file in directory $targetDir.  A temporary
+# file in $targetDir is created and an attempt to create a
+# hardlink of the same name in $newDir is made.  The temporary
+# files are removed.
+#
+# Like link(), returns true on success and false on failure.
+#
+sub HardlinkTest
+{
+    my($bpc, $targetDir, $newDir) = @_;
+
+    my($targetFile, $newFile, $fd);
+    for ( my $i = 0 ; ; $i++ ) {
+        $targetFile = "$targetDir/.TestFileLink.$$.$i";
+        $newFile    = "$newDir/.TestFileLink.$$.$i";
+        last if ( !-e $targetFile && !-e $newFile );
+    }
+    return 0 if ( !open($fd, ">", $targetFile) );
+    close($fd);
+    my $ret = link($targetFile, $newFile);
+    unlink($targetFile);
+    unlink($newFile);
+    return $ret;
+}
+
 sub CheckHostAlive
 {
     my($bpc, $host) = @_;
index de166a9..7959a81 100644 (file)
@@ -56,7 +56,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 0f7a43e..ed9147d 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index b99648d..7c4f1f7 100644 (file)
@@ -30,7 +30,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -85,16 +85,15 @@ sub BackupInfoRead
     }
     close(LOCK);
     #
-    # Default the level and version fields if not present
+    # Default the version field.  Prior to 3.0.0 the xferMethod
+    # field is empty, so we use that to figure out the version.
     #
     for ( my $i = 0 ; $i < @Backups ; $i++ ) {
-        if ( defined($Backups[$i]{level}) ) {
-            if ( !defined($Backups[$i]{version}) ) {
-                $Backups[$i]{version} = "3.0.0";
-            }
-        } else {
-            $Backups[$i]{level} = $Backups[$i]{type} eq "incr" ? 1 : 0;
+        next if ( $Backups[$i]{version} ne "" );
+        if ( $Backups[$i]{xferMethod} eq "" ) {
             $Backups[$i]{version} = "2.1.2";
+        } else {
+            $Backups[$i]{version} = "3.0.0";
         }
     }
     return @Backups;
index 64d5abe..832962e 100644 (file)
@@ -31,7 +31,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -46,6 +46,7 @@ use BackupPC::Lib;
 use BackupPC::Attrib qw(:all);
 use BackupPC::FileZIO;
 use Data::Dumper;
+use Encode qw/from_to/;
 
 sub new
 {
@@ -109,7 +110,8 @@ sub dirCache
        push(@{$m->{mergeNums}}, $backupNum);
        my $mangle   = $m->{backups}[$i]{mangle};
        my $compress = $m->{backups}[$i]{compress};
-       my $path = "$m->{topDir}/pc/$m->{host}/$backupNum/";
+       my $path     = "$m->{topDir}/pc/$m->{host}/$backupNum/";
+       my $legacyCharset = $m->{backups}[$i]{version} < 3.0;
         my $sharePathM;
         if ( $mangle ) {
             $sharePathM = $m->{bpc}->fileNameEltMangle($share)
@@ -118,9 +120,17 @@ sub dirCache
             $sharePathM = $share . $dir;
         }
         $path .= $sharePathM;
-       #print(STDERR "Opening $path (share=$share)\n");
+        #print(STDERR "Opening $path (share=$share, mangle=$mangle)\n");
+
+        my $dirOpts    = { %{$m->{dirOpts} || {} } };
+        my $attribOpts = { compress => $compress };
+        if ( $legacyCharset ) {
+            $dirOpts->{charsetLegacy}
+                    = $attribOpts->{charsetLegacy}
+                    = $m->{bpc}->{Conf}{ClientCharsetLegacy} || "iso-8859-1";
+        }
 
-        my $dirInfo = $m->{bpc}->dirRead($path, $m->{dirOpts});
+        my $dirInfo = $m->{bpc}->dirRead($path, $dirOpts);
        if ( !defined($dirInfo) ) {
             if ( $i == $m->{idx} ) {
                 #
@@ -133,9 +143,9 @@ sub dirCache
         }
         my $attr;
        if ( $mangle ) {
-           $attr = BackupPC::Attrib->new({ compress => $compress });
+           $attr = BackupPC::Attrib->new($attribOpts);
            if ( !$attr->read($path) ) {
-                $m->{error} = "Can't read attribute file in $path";
+                $m->{error} = "Can't read attribute file in $path: " . $attr->errStr();
                $attr = undef;
            }
        }
@@ -152,6 +162,7 @@ sub dirCache
                    || $file eq "."
                    || $file eq "backupInfo"
                    || $mangle && $file eq "attrib" );
+
             if ( defined($attr) && defined(my $a = $attr->get($fileUM)) ) {
                 $m->{files}{$fileUM} = $a;
                 #
@@ -166,7 +177,12 @@ sub dirCache
                 # is on.  We have to stat the file and read compressed files
                 # to determine their size.
                 #
-                my @s = stat("$path/$file");
+                my $realPath = "$path/$file";
+
+                from_to($realPath, "utf8", $attribOpts->{charsetLegacy})
+                                if ( $attribOpts->{charsetLegacy} ne "" );
+
+                my @s = stat($realPath);
                 next if ( $i < $m->{idx} && -d _ );
                 $m->{files}{$fileUM} = {
                     type  => -d _ ? BPC_FTYPE_DIR : BPC_FTYPE_FILE,
@@ -180,10 +196,10 @@ sub dirCache
                     #
                     # Compute the correct size by reading the whole file
                     #
-                    my $f = BackupPC::FileZIO->open("$path/$file",
+                    my $f = BackupPC::FileZIO->open($realPath,
                                                    0, $compress);
                     if ( !defined($f) ) {
-                        $m->{error} = "Can't open $path/$file";
+                        $m->{error} = "Can't open $realPath";
                     } else {
                         my($data, $size);
                         while ( $f->read(\$data, 65636 * 8) > 0 ) {
@@ -198,6 +214,8 @@ sub dirCache
             ($m->{files}{$fileUM}{sharePathM} = "$sharePathM/$file")
                                                                =~ s{//+}{/}g;
             ($m->{files}{$fileUM}{fullPath}   = "$path/$file") =~ s{//+}{/}g;
+            from_to($m->{files}{$fileUM}{fullPath}, "utf8", $attribOpts->{charsetLegacy})
+                                if ( $attribOpts->{charsetLegacy} ne "" );
             $m->{files}{$fileUM}{backupNum}   = $backupNum;
             $m->{files}{$fileUM}{compress}    = $compress;
            $m->{files}{$fileUM}{nlink}       = $entry->{nlink}
@@ -218,6 +236,8 @@ sub dirCache
                $m->{files}{$fileUM}{relPath}    = "$dir/$fileUM";
                $m->{files}{$fileUM}{sharePathM} = "$sharePathM/$file";
                $m->{files}{$fileUM}{fullPath}   = "$path/$file";
+                from_to($m->{files}{$fileUM}{fullPath}, "utf8", $attribOpts->{charsetLegacy})
+                                    if ( $attribOpts->{charsetLegacy} ne "" );
                $m->{files}{$fileUM}{backupNum}  = $backupNum;
                $m->{files}{$fileUM}{compress}   = $compress;
                $m->{files}{$fileUM}{nlink}      = 0;
@@ -378,6 +398,7 @@ sub dirHistory
        my $mangle    = $m->{backups}[$i]{mangle};
        my $compress  = $m->{backups}[$i]{compress};
        my $path      = "$m->{topDir}/pc/$m->{host}/$backupNum/";
+       my $legacyCharset = $m->{backups}[$i]{version} < 3.0;
         my $sharePathM;
         if ( $mangle ) {
             $sharePathM = $m->{bpc}->fileNameEltMangle($share)
@@ -388,7 +409,15 @@ sub dirHistory
         $path .= $sharePathM;
        #print(STDERR "Opening $path (share=$share)\n");
 
-        my $dirInfo = $m->{bpc}->dirRead($path, $m->{dirOpts});
+        my $dirOpts    = { %{$m->{dirOpts} || {} } };
+        my $attribOpts = { compress => $compress };
+        if ( $legacyCharset ) {
+            $dirOpts->{charsetLegacy}
+                    = $attribOpts->{charsetLegacy}
+                    = $m->{bpc}->{Conf}{ClientCharsetLegacy} || "iso-8859-1";
+        }
+
+        my $dirInfo = $m->{bpc}->dirRead($path, $dirOpts);
        if ( !defined($dirInfo) ) {
            #
            # Oops, directory doesn't exist.
@@ -397,7 +426,7 @@ sub dirHistory
         }
         my $attr;
        if ( $mangle ) {
-           $attr = BackupPC::Attrib->new({ compress => $compress });
+           $attr = BackupPC::Attrib->new($attribOpts);
            if ( !$attr->read($path) ) {
                 $m->{error} = "Can't read attribute file in $path";
                $attr = undef;
@@ -415,7 +444,11 @@ sub dirHistory
                    || $file eq "."
                    || $mangle && $file eq "attrib"
                    || defined($files->{$fileUM}[$i]) );
-           my @s = stat("$path/$file");
+
+            my $realPath = "$path/$file";
+            from_to($realPath, "utf8", $attribOpts->{charsetLegacy})
+                            if ( $attribOpts->{charsetLegacy} ne "" );
+            my @s = stat($realPath);
             if ( defined($attr) && defined(my $a = $attr->get($fileUM)) ) {
                 $files->{$fileUM}[$i] = $a;
                $attr->set($fileUM, undef);
@@ -437,7 +470,7 @@ sub dirHistory
                     #
                     # Compute the correct size by reading the whole file
                     #
-                    my $f = BackupPC::FileZIO->open("$path/$file",
+                    my $f = BackupPC::FileZIO->open("$realPath",
                                                    0, $compress);
                     if ( !defined($f) ) {
                         $m->{error} = "Can't open $path/$file";
index a7c9a57..356e6b8 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index ad3a5a5..5a1e795 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 67e5296..460e31a 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 3af92f7..85434d7 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 221fd3f..fd2df3b 100644 (file)
@@ -12,7 +12,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index eed9d9e..f3b5cfd 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 60bfd36..d11bd67 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 55c4347..8336f14 100644 (file)
@@ -33,7 +33,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
index 1366c9f..65e4607 100755 (executable)
--- a/makeDist
+++ b/makeDist
@@ -53,8 +53,8 @@ die("BackupPC::Lib->new failed\n")
 
 umask(0022);
 
-my $Version     = "3.1.0";
-my $ReleaseDate = "15 Apr 2007";
+my $Version     = "3.1.0beta0";
+my $ReleaseDate = "3 Sep 2007";
 my $DistDir     = "dist/BackupPC-$Version";
 
 my @PerlSrc = qw(
@@ -157,6 +157,7 @@ $ConfVars->{LogDir}       = 2;
 $ConfVars->{ConfDir}      = 2;
 $ConfVars->{InstallDir}   = 2;
 $ConfVars->{CgiImageDir}  = 2;
+$ConfVars->{ClientCharsetLegacy}  = 2;      # actually used
 
 #
 # These config parameters are used in the code to be backward compatible,