From df717077755b9331fa245f72933ef03add7a3710 Mon Sep 17 00:00:00 2001 From: cbarratt Date: Fri, 4 Aug 2006 06:54:54 +0000 Subject: [PATCH] * Various changes for 3.0.0beta1 * Fixed several Xfer charset conversions. * Added some CGI utf8 conversions from Rodrigo Real and Vincent Fleuranceau. * Host name is forced to lower case, to match 2.x. * Fixed LOG file naming in BackupPC_restore and BackupPC_archive. * GFK applied fr.pm corrections from Nicolas Stransky. * Updated init.d/src scripts for FHS (ie: replaced __TOPDIR__/log with __LOGDIR__ and __TOPDIR__/conf with __CONFDIR__). Patch provided by Rodrigo Real. * Added --log-dir and --conf-dir options to configure.pl. Reported by Vincent Fleuranceau. * Updated File::RsyncP version check in configure.pl, reported by Vincent Fleuranceau. Changed File::RsyncP version to 0.64. --- ChangeLog | 25 ++++++++++++++++ README | 9 +++--- bin/BackupPC | 2 +- bin/BackupPC_archive | 27 ++++++++++++++++-- bin/BackupPC_archiveHost | 2 +- bin/BackupPC_attribPrint | 2 +- bin/BackupPC_compressPool | 2 +- bin/BackupPC_dump | 7 ++++- bin/BackupPC_fixupBackupSummary | 2 +- bin/BackupPC_link | 2 +- bin/BackupPC_nightly | 2 +- bin/BackupPC_restore | 43 ++++++++++++++++++++++------ bin/BackupPC_sendEmail | 2 +- bin/BackupPC_serverMesg | 2 +- bin/BackupPC_tarCreate | 5 ++-- bin/BackupPC_tarExtract | 6 ++-- bin/BackupPC_tarPCCopy | 2 +- bin/BackupPC_trashClean | 2 +- bin/BackupPC_zcat | 2 +- bin/BackupPC_zipCreate | 5 ++-- cgi-bin/BackupPC_Admin | 2 +- conf/config.pl | 30 ++++++++++++++++---- configure.pl | 17 ++++++----- doc-src/BackupPC.pod | 44 ++++++++++++----------------- init.d/src/debian-backuppc | 11 ++++---- init.d/src/gentoo-backuppc.conf | 5 ++-- init.d/src/suse-backuppc | 11 ++++---- lib/BackupPC/Attrib.pm | 2 +- lib/BackupPC/CGI/AdminOptions.pm | 2 +- lib/BackupPC/CGI/Archive.pm | 2 +- lib/BackupPC/CGI/ArchiveInfo.pm | 2 +- lib/BackupPC/CGI/Browse.pm | 7 +++-- lib/BackupPC/CGI/DirHistory.pm | 6 ++-- lib/BackupPC/CGI/EditConfig.pm | 4 +-- lib/BackupPC/CGI/EmailSummary.pm | 2 +- lib/BackupPC/CGI/GeneralInfo.pm | 2 +- lib/BackupPC/CGI/HostInfo.pm | 2 +- lib/BackupPC/CGI/LOGlist.pm | 2 +- lib/BackupPC/CGI/Lib.pm | 2 +- lib/BackupPC/CGI/Queue.pm | 2 +- lib/BackupPC/CGI/RSS.pm | 2 +- lib/BackupPC/CGI/ReloadServer.pm | 2 +- lib/BackupPC/CGI/Restore.pm | 5 +++- lib/BackupPC/CGI/RestoreFile.pm | 7 +++-- lib/BackupPC/CGI/RestoreInfo.pm | 2 +- lib/BackupPC/CGI/StartServer.pm | 2 +- lib/BackupPC/CGI/StartStopBackup.pm | 2 +- lib/BackupPC/CGI/StopServer.pm | 2 +- lib/BackupPC/CGI/Summary.pm | 2 +- lib/BackupPC/CGI/View.pm | 2 +- lib/BackupPC/Config/Meta.pm | 2 +- lib/BackupPC/FileZIO.pm | 8 ++++-- lib/BackupPC/Lib.pm | 4 +-- lib/BackupPC/PoolWrite.pm | 2 +- lib/BackupPC/Storage.pm | 2 +- lib/BackupPC/Storage/Text.pm | 6 ++-- lib/BackupPC/View.pm | 10 +++---- lib/BackupPC/Xfer/Archive.pm | 2 +- lib/BackupPC/Xfer/BackupPCd.pm | 2 +- lib/BackupPC/Xfer/Rsync.pm | 38 +++++++++++++++++++++---- lib/BackupPC/Xfer/RsyncDigest.pm | 2 +- lib/BackupPC/Xfer/RsyncFileIO.pm | 24 ++++++++-------- lib/BackupPC/Xfer/Smb.pm | 14 ++++++++- lib/BackupPC/Xfer/Tar.pm | 22 ++++++++++++--- lib/BackupPC/Zip/FileMember.pm | 2 +- makeDist | 4 +-- 66 files changed, 320 insertions(+), 160 deletions(-) diff --git a/ChangeLog b/ChangeLog index 54d6619..2873269 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,31 @@ # Version __VERSION__, __RELEASEDATE__ #------------------------------------------------------------------------ +* Fixed several Xfer charset conversions. + +* Added some CGI utf8 conversions from Rodrigo Real and Vincent + Fleuranceau. + +* Host name is forced to lower case, to match 2.x. + +* Fixed LOG file naming in BackupPC_restore and BackupPC_archive. + +* GFK applied fr.pm corrections from Nicolas Stransky. + +* Updated init.d/src scripts for FHS (ie: replaced __TOPDIR__/log + with __LOGDIR__ and __TOPDIR__/conf with __CONFDIR__). Patch + provided by Rodrigo Real. + +* Added --log-dir and --conf-dir options to configure.pl. + Reported by Vincent Fleuranceau. + +* Updated File::RsyncP version check in configure.pl, reported + by Vincent Fleuranceau. Changed File::RsyncP version to 0.64. + +#------------------------------------------------------------------------ +# Version 3.0.0beta0, 11 Jul 2006 +#------------------------------------------------------------------------ + * Added configuration and host CGI editor. * Added rsync hardlink support. Requires latest version of diff --git a/README b/README index be5bf1e..80e4b3c 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ __RELEASEDATE__ - Copyright (C) 2001-2003 Craig Barratt. All rights reserved. + Copyright (C) 2001-2006 Craig Barratt. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. @@ -33,13 +33,14 @@ To install BackupPC run these commands as root: perl configure.pl This will automatically determine some system information and prompt you -for install paths. +for install paths. Do "perldoc configure.pl" to see the various options +that configure.pl provides. INTRODUCTION: ------------ -BackupPC is a high-performance, enterprise-grade system for -backing up Linux and WinXX PCs and laptops to a server's disk. +BackupPC is a high-performance, enterprise-grade system for backing +up Linux, WinXX, and MacOS PCs and laptops to a server's disk. BackupPC is highly configurable and easy to install and maintain. Given the ever decreasing cost of disks and raid systems, it is now diff --git a/bin/BackupPC b/bin/BackupPC index d981c18..3e55f7f 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_archive b/bin/BackupPC_archive index 9695906..ad10f1f 100644 --- a/bin/BackupPC_archive +++ b/bin/BackupPC_archive @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -91,9 +91,30 @@ mkpath($Dir, 0, 0777) if ( !-d $Dir ); if ( !-f "$Dir/LOCK" ) { open(LOCK, ">", "$Dir/LOCK") && close(LOCK); } -open(LOG, ">>", "$Dir/LOG"); -select(LOG); $| = 1; select(STDOUT); +my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my $logPath = sprintf("$Dir/LOG.%02d%04d", $mon + 1, $year + 1900); + +if ( !-f $logPath ) { + # + # Compress and prune old log files + # + my $lastLog = $Conf{MaxOldPerPCLogFiles} - 1; + foreach my $file ( $bpc->sortedPCLogFiles($client) ) { + if ( $lastLog <= 0 ) { + unlink($file); + next; + } + $lastLog--; + next if ( $file =~ /\.z$/ || !$Conf{CompressLevel} ); + BackupPC::FileZIO->compressCopy($file, + "$file.z", + undef, + $Conf{CompressLevel}, 1); + } +} +open(LOG, ">>", $logPath); +select(LOG); $| = 1; select(STDOUT); # # Read the request file diff --git a/bin/BackupPC_archiveHost b/bin/BackupPC_archiveHost index ff033bf..84dae6a 100755 --- a/bin/BackupPC_archiveHost +++ b/bin/BackupPC_archiveHost @@ -38,7 +38,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_attribPrint b/bin/BackupPC_attribPrint index 8a7d58c..72ea295 100755 --- a/bin/BackupPC_attribPrint +++ b/bin/BackupPC_attribPrint @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_compressPool b/bin/BackupPC_compressPool index 8d173e1..83867f0 100755 --- a/bin/BackupPC_compressPool +++ b/bin/BackupPC_compressPool @@ -49,7 +49,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index 4472b23..f47b6e3 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -70,7 +70,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -86,6 +86,7 @@ use BackupPC::Xfer::Smb; use BackupPC::Xfer::Tar; use BackupPC::Xfer::Rsync; use BackupPC::Xfer::BackupPCd; +use Encode; use Socket; use File::Path; use File::Find; @@ -581,6 +582,10 @@ $NeedPostCmd = 1; for my $shareName ( @$ShareNames ) { local(*RH, *WH); + # + # Convert $shareName to utf8 octets + # + $shareName = encode("utf8", $shareName); $stat{xferOK} = $stat{hostAbort} = undef; $stat{hostError} = $stat{lastOutputLine} = undef; if ( -d "$Dir/new/$shareName" ) { diff --git a/bin/BackupPC_fixupBackupSummary b/bin/BackupPC_fixupBackupSummary index 86e5e41..70177d5 100755 --- a/bin/BackupPC_fixupBackupSummary +++ b/bin/BackupPC_fixupBackupSummary @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_link b/bin/BackupPC_link index 20825f2..be888d3 100755 --- a/bin/BackupPC_link +++ b/bin/BackupPC_link @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_nightly b/bin/BackupPC_nightly index 9794b67..2639b41 100755 --- a/bin/BackupPC_nightly +++ b/bin/BackupPC_nightly @@ -55,7 +55,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index 3f58ca6..8af7550 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -101,9 +101,30 @@ mkpath($Dir, 0, 0777) if ( !-d $Dir ); if ( !-f "$Dir/LOCK" ) { open(LOCK, ">", "$Dir/LOCK") && close(LOCK); } -open(LOG, ">>", "$Dir/LOG"); -select(LOG); $| = 1; select(STDOUT); +my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my $logPath = sprintf("$Dir/LOG.%02d%04d", $mon + 1, $year + 1900); + +if ( !-f $logPath ) { + # + # Compress and prune old log files + # + my $lastLog = $Conf{MaxOldPerPCLogFiles} - 1; + foreach my $file ( $bpc->sortedPCLogFiles($client) ) { + if ( $lastLog <= 0 ) { + unlink($file); + next; + } + $lastLog--; + next if ( $file =~ /\.z$/ || !$Conf{CompressLevel} ); + BackupPC::FileZIO->compressCopy($file, + "$file.z", + undef, + $Conf{CompressLevel}, 1); + } +} +open(LOG, ">>", $logPath); +select(LOG); $| = 1; select(STDOUT); # # Read the request file @@ -196,6 +217,7 @@ my $RestoreLOG = BackupPC::FileZIO->open("$Dir/RestoreLOG$fileExt", 1, $Conf{CompressLevel}); my $tarCreateFileCnt = 0; my $tarCreateByteCnt = 0; +my $tarCreateDirCnt = 0; my $tarCreateErrCnt = 1; # assume not ok until we learn otherwise my $tarCreateErr; my($logMsg, $xfer); @@ -329,10 +351,10 @@ if ( $useTar ) { @tarPathOpts, @{$RestoreReq{fileList}}, ); - my $logMsg = "Running: " + my $runMsg = "Running: " . $bpc->execCmd2ShellCmd("$BinDir/BackupPC_tarCreate", @tarArgs) . "\n"; - $RestoreLOG->write(\$logMsg); + $RestoreLOG->write(\$runMsg); if ( !defined($tarPid = open(TAR, "-|")) ) { close(WH); # FIX: need to cleanup xfer @@ -402,6 +424,7 @@ if ( $useTar ) { if ( /^Done: (\d+) files, (\d+) bytes, (\d+) dirs, (\d+) specials, (\d+) errors/ ) { $tarCreateFileCnt = $1; $tarCreateByteCnt = $2; + $tarCreateDirCnt = $3; $tarCreateErrCnt = $5; } } @@ -426,7 +449,7 @@ if ( $useTar ) { # # otherwise the xfer module does everything for us # - print(LOG $bpc->timeStamp, "Starting restore\n"); + print(LOG $bpc->timeStamp, $logMsg . "\n"); print("started_restore\n"); ($tarCreateFileCnt, $tarCreateByteCnt, $tarCreateErrCnt, $tarCreateErr) = $xfer->run(); @@ -573,7 +596,7 @@ sub RestoreCleanup if ( $stat{hostAbort} && $stat{hostError} eq "" ) { $stat{hostError} = "lost network connection during restore"; } - $RestoreLOG->write(\"Restore failed: $stat{hostError}\n") + $RestoreLOG->write(\"restore failed: $stat{hostError}\n") if ( defined($RestoreLOG) ); } @@ -604,10 +627,14 @@ sub RestoreCleanup $bpc->RestoreInfoWrite($client, @Restores); if ( !$stat{xferOK} ) { - print(LOG $bpc->timeStamp, "Restore failed ($stat{hostError})\n"); + print(LOG $bpc->timeStamp, "restore failed ($stat{hostError})\n"); print("restore failed: $stat{hostError}\n"); return 1; } else { + $stat{xferErrCnt} ||= 0; + print(LOG $bpc->timeStamp, "restore $lastNum complete" + . " ($tarCreateFileCnt files, $tarCreateByteCnt bytes," + . " $tarCreateDirCnt dirs, $stat{xferErrCnt} xferErrs)\n"); print("restore complete\n"); return; } diff --git a/bin/BackupPC_sendEmail b/bin/BackupPC_sendEmail index 33824e2..4b8d652 100755 --- a/bin/BackupPC_sendEmail +++ b/bin/BackupPC_sendEmail @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_serverMesg b/bin/BackupPC_serverMesg index 3a9f512..332afc8 100755 --- a/bin/BackupPC_serverMesg +++ b/bin/BackupPC_serverMesg @@ -43,7 +43,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarCreate b/bin/BackupPC_tarCreate index d0f4fe7..4eeabfa 100755 --- a/bin/BackupPC_tarCreate +++ b/bin/BackupPC_tarCreate @@ -53,7 +53,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -131,8 +131,7 @@ $Charset = $opts{e} if ( $opts{e} ne "" ); my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ ); my $PathAdd = $1 if ( $opts{p} =~ /(.+)/ ); -if ( ($opts{s} !~ /^([\w\s.@\/$(){}[\]-]+)$/ - || $opts{s} =~ m{(^|/)\.\.(/|$)}) && $opts{s} ne "*" ) { +if ( $opts{s} =~ m{(^|/)\.\.(/|$)} ) { print(STDERR "$0: bad share name '$opts{s}'\n"); exit(1); } diff --git a/bin/BackupPC_tarExtract b/bin/BackupPC_tarExtract index 0ab4b99..2f57fe6 100755 --- a/bin/BackupPC_tarExtract +++ b/bin/BackupPC_tarExtract @@ -27,7 +27,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -59,11 +59,11 @@ if ( $ARGV[0] !~ /^([\w\.\s-]+)$/ ) { exit(1); } my $client = $1; -if ( $ARGV[1] !~ /^([\w\s.\/$(){}[\]-]+)$/ ) { +if ( $ARGV[1] =~ m{(^|/)\.\.(/|$)} ) { print("$0: bad share name '$ARGV[1]'\n"); exit(1); } -my $ShareNameUM = $1; +my $ShareNameUM = $1 if ( $ARGV[1] =~ /(.*)/ ); my $ShareName = $bpc->fileNameEltMangle($ShareNameUM); if ( $ARGV[2] !~ /^(\d+)$/ ) { print("$0: bad compress level '$ARGV[2]'\n"); diff --git a/bin/BackupPC_tarPCCopy b/bin/BackupPC_tarPCCopy index 8c6ff2e..e9477a8 100755 --- a/bin/BackupPC_tarPCCopy +++ b/bin/BackupPC_tarPCCopy @@ -36,7 +36,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_trashClean b/bin/BackupPC_trashClean index e74792f..d5a58d4 100755 --- a/bin/BackupPC_trashClean +++ b/bin/BackupPC_trashClean @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zcat b/bin/BackupPC_zcat index c316f93..59dff2a 100755 --- a/bin/BackupPC_zcat +++ b/bin/BackupPC_zcat @@ -32,7 +32,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zipCreate b/bin/BackupPC_zipCreate index adcb709..46731d8 100755 --- a/bin/BackupPC_zipCreate +++ b/bin/BackupPC_zipCreate @@ -52,7 +52,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -142,8 +142,7 @@ $Charset = $opts{e} if ( $opts{e} ne "" ); my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ ); my $PathAdd = $1 if ( $opts{p} =~ /(.+)/ ); -if ( $opts{s} !~ /^([\w\s.@\/$(){}[\]-]+)$/ - || $opts{s} =~ m{(^|/)\.\.(/|$)} ) { +if ( $opts{s} =~ m{(^|/)\.\.(/|$)} ) { print(STDERR "$0: bad share name '$opts{s}'\n"); exit(1); } diff --git a/cgi-bin/BackupPC_Admin b/cgi-bin/BackupPC_Admin index 082b91e..e099be4 100755 --- a/cgi-bin/BackupPC_Admin +++ b/cgi-bin/BackupPC_Admin @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/conf/config.pl b/conf/config.pl index 62c301a..46fd26f 100644 --- a/conf/config.pl +++ b/conf/config.pl @@ -843,12 +843,32 @@ $Conf{XferLogLevel} = 1; # # Filename charset encoding on the client. BackupPC uses utf8 # on the server for filename encoding. If this is empty, then -# utf8 is assumed and client filenames will not be modified. If set -# to a different encoding then filenames will be re-encoded in utf8. -# A typical WinXX encoding for latin1/western europe is 'cp1252'. +# utf8 is assumed and client filenames will not be modified. +# If set to a different encoding then filenames will converted +# to/from utf8 automatically during backup and restore. +# +# If the file names displayed in the browser (eg: accents or special +# characters) don't look right then it is likely you haven't set +# $Conf{ClientCharset} correctly. +# +# If you are using smbclient on a WinXX machine, smbclient will convert +# to the "unix charset" setting in smb.conf. The default is utf8, +# in which case leave $Conf{ClientCharset} empty since smbclient does +# the right conversion. +# +# If you are using rsync on a WinXX machine then it does no conversion. +# A typical WinXX encoding for latin1/western europe is 'cp1252', +# so in this case set $Conf{ClientCharset} to 'cp1252'. +# +# On a linux or unix client, run "locale charmap" to see the client's +# charset. Set $Conf{ClientCharset} to this value. A typical value +# for english/US is 'ISO-8859-1'. +# # Do "perldoc Encode::Supported" to see the list of possible charset -# values, and also see http://czyborra.com/charsets/iso8859.html. -# +# values. The FAQ at http://www.cl.cam.ac.uk/~mgk25/unicode.html +# is excellent, and http://czyborra.com/charsets/iso8859.html +# provides more information on the iso-8859 charsets. +# $Conf{ClientCharset} = ''; # diff --git a/configure.pl b/configure.pl index f2a475b..433a016 100755 --- a/configure.pl +++ b/configure.pl @@ -87,6 +87,7 @@ if ( !GetOptions( "cgi-dir=s", "compress-level=i", "config-path=s", + "config-dir=s", "data-dir=s", "dest-dir=s", "fhs!", @@ -95,6 +96,7 @@ if ( !GetOptions( "html-dir=s", "html-dir-url=s", "install-dir=s", + "log-dir=s", "man", "set-perms!", "uid-ignore!", @@ -105,6 +107,7 @@ pod2usage(1) if ( $opts{help} ); pod2usage(-exitstatus => 0, -verbose => 2) if $opts{man}; my $DestDir = $opts{"dest-dir"}; +$DestDir = "" if ( $DestDir eq "/" ); if ( !$opts{"uid-ignore"} && $< != 0 ) { print <. The package is called cygwin-rsync. It contains rsync.exe, template setup files and the minimal set of cygwin libraries for everything to run. The README file contains instructions for running rsync as a service, so it starts -automatically everytime you boot your machine. - -If you build your own rsync, for rsync 2.6.2 it is strongly -recommended you apply the patch in the cygwin-rsync package on -L. This patch adds the --checksum-seed -option for checksum caching, and also sends all errors to the client, -which is important so BackupPC can log all file access errors. - +automatically everytime you boot your machine. If you use rsync +to backup WinXX machines, be sure to set $Conf{ClientCharset} +correctly (eg: 'cp1252') so that the WinXX file name encoding is +correctly converted to utf8. Otherwise, to use SMB, you can either create shares for the data you want to backup or your can use the existing C$ share. To create a new @@ -885,23 +880,16 @@ ksmbfs or similar) on your linux/unix server to mount the share, and then set $Conf{XferMethod} to "tar" (use tar on the network mounted file system). -Also, to make sure that file names with 8-bit characters are correctly -transferred by smbclient you should add this to samba's smb.conf file -for samba 2.x: - - [global] - # Accept the windows charset - client code page = 850 - character set = ISO8859-1 - -For samba 3.x this should instead be: +Also, to make sure that file names with special characters are correctly +transferred by smbclient you should make sure that the smb.conf file +has (for samba 3.x): [global] - unix charset = ISO8859-1 + unix charset = UTF8 -This setting should work for western europe. -See L -for more information about settings for other languages. +UTF8 is the default setting, so if the parameter is missing then it +is ok. With this setting $Conf{ClientCharset} should be emtpy, +since smbclient has already converted the file names to utf8. =item Linux/Unix @@ -961,6 +949,10 @@ See the rsyncd.conf manual page for more information. =back +You need to set $Conf{ClientCharset} to the client's charset so that +file names are correctly converted to utf8. Use "locale charmap" +on the client to see its charset. + For linux/unix machines you should not backup "/proc". This directory contains a variety of files that look like regular files but they are special files that don't need to be backed up (eg: /proc/kcore is a diff --git a/init.d/src/debian-backuppc b/init.d/src/debian-backuppc index f1274c4..f97eb2c 100755 --- a/init.d/src/debian-backuppc +++ b/init.d/src/debian-backuppc @@ -12,6 +12,7 @@ set -e # BINDIR=__INSTALLDIR__/bin DATADIR=__TOPDIR__ +LOGDIR=__LOGDIR__ USER=__BACKUPPCUSER__ # NAME=backuppc @@ -22,27 +23,27 @@ test -x $BINDIR/$DAEMON || exit 0 case "$1" in start) echo -n "Starting $NAME: " - start-stop-daemon --start --pidfile $DATADIR/log/BackupPC.pid \ + start-stop-daemon --start --pidfile $LOGDIR/BackupPC.pid \ -c $USER --exec $BINDIR/$DAEMON -- -d echo "ok." ;; stop) echo -n "Stopping $NAME: " - start-stop-daemon --stop --pidfile $DATADIR/log/BackupPC.pid -u $USER \ + start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid -u $USER \ --oknodo --retry 30 -x /usr/bin/perl echo "ok." ;; restart) echo -n "Restarting $NAME: " - start-stop-daemon --stop --pidfile $DATADIR/log/BackupPC.pid -u $USER \ + start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid -u $USER \ --oknodo --retry 30 -x /usr/bin/perl - start-stop-daemon --start --pidfile $DATADIR/log/BackupPC.pid \ + start-stop-daemon --start --pidfile $LOGDIR/BackupPC.pid \ -c $USER --exec $BINDIR/$DAEMON -- -d echo "ok." ;; reload|force-reload) echo "Reloading $NAME configuration files" - start-stop-daemon --stop --pidfile $DATADIR/log/BackupPC.pid \ + start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid \ --signal 1 -x /usr/bin/perl ;; *) diff --git a/init.d/src/gentoo-backuppc.conf b/init.d/src/gentoo-backuppc.conf index f53890c..2350eb5 100644 --- a/init.d/src/gentoo-backuppc.conf +++ b/init.d/src/gentoo-backuppc.conf @@ -1,6 +1,5 @@ -CONF_FILE=__TOPDIR__/conf/config.pl +CONF_FILE=__CONFDIR__/config.pl USER=__BACKUPPCUSER__ -PID_FILE=__TOPDIR__/log/BackupPC.pid +PID_FILE=__LOGDIR__/BackupPC.pid EXEC=__INSTALLDIR__/bin/BackupPC EXEC_OPTIONS=-d - diff --git a/init.d/src/suse-backuppc b/init.d/src/suse-backuppc index 00049cc..52a489d 100755 --- a/init.d/src/suse-backuppc +++ b/init.d/src/suse-backuppc @@ -12,6 +12,7 @@ set -e # BINDIR=__INSTALLDIR__/bin DATADIR=__TOPDIR__ +LOGDIR=__LOGDIR__ USER=__BACKUPPCUSER__ # NAME=backuppc @@ -22,27 +23,27 @@ test -x $BINDIR/$DAEMON || exit 0 case "$1" in start) echo -n "Starting $NAME: " - startproc -f -p $DATADIR/log/BackupPC.pid -u $USER $BINDIR/$DAEMON -d + startproc -f -p $LOGDIR/BackupPC.pid -u $USER $BINDIR/$DAEMON -d echo "ok." ;; stop) echo -n "Stopping $NAME: " - start-stop-daemon --stop --pidfile $DATADIR/log/BackupPC.pid -u $USER \ + start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid -u $USER \ --oknodo echo "ok." ;; restart) echo -n "Stopping $NAME: " - start-stop-daemon --stop --pidfile $DATADIR/log/BackupPC.pid -u $USER \ + start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid -u $USER \ --oknodo echo "ok." echo -n "Starting $NAME: " - startproc -f -p $DATADIR/log/BackupPC.pid -u $USER $BINDIR/$DAEMON -d + startproc -f -p $LOGDIR/BackupPC.pid -u $USER $BINDIR/$DAEMON -d echo "ok." ;; reload|force-reload) echo "Reloading $NAME configuration files" - start-stop-daemon --stop --pidfile $DATADIR/log/BackupPC.pid \ + start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid \ --signal 1 -x /usr/bin/perl ;; *) diff --git a/lib/BackupPC/Attrib.pm b/lib/BackupPC/Attrib.pm index c90f16f..fb904b5 100644 --- a/lib/BackupPC/Attrib.pm +++ b/lib/BackupPC/Attrib.pm @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/AdminOptions.pm b/lib/BackupPC/CGI/AdminOptions.pm index f425f56..b7da86a 100644 --- a/lib/BackupPC/CGI/AdminOptions.pm +++ b/lib/BackupPC/CGI/AdminOptions.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Archive.pm b/lib/BackupPC/CGI/Archive.pm index 8041617..d11b3f3 100644 --- a/lib/BackupPC/CGI/Archive.pm +++ b/lib/BackupPC/CGI/Archive.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/ArchiveInfo.pm b/lib/BackupPC/CGI/ArchiveInfo.pm index 8538528..dc0675a 100644 --- a/lib/BackupPC/CGI/ArchiveInfo.pm +++ b/lib/BackupPC/CGI/ArchiveInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Browse.pm b/lib/BackupPC/CGI/Browse.pm index ab3b13a..e327b05 100644 --- a/lib/BackupPC/CGI/Browse.pm +++ b/lib/BackupPC/CGI/Browse.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -107,6 +107,7 @@ sub action $attr = $view->dirAttrib($num, $share, $relDir); if ( !defined($attr) ) { + $relDir = decode_utf8($relDir); ErrorExit(eval("qq{$Lang->{Can_t_browse_bad_directory_name2}}")); } @@ -254,11 +255,10 @@ EOF } } $share = $currDir; - my $dirDisplay = "$share/$dir"; + my $dirDisplay = decode_utf8("$share/$dir"); $dirDisplay =~ s{//+}{/}g; $dirDisplay =~ s{/+$}{}g; $dirDisplay = "/" if ( $dirDisplay eq "" ); - $dirDisplay = decode_utf8($dirDisplay); my $filledBackup; if ( (my @mergeNums = @{$view->mergeNums}) > 1 ) { @@ -301,6 +301,7 @@ EOF } $filledBackup .= eval("qq{$Lang->{Visit_this_directory_in_backup}}"); } + $dir = decode_utf8($dir); my $content = eval("qq{$Lang->{Backup_browse_for__host}}"); Header(eval("qq{$Lang->{Browse_backup__num_for__host}}"), $content); Trailer(); diff --git a/lib/BackupPC/CGI/DirHistory.pm b/lib/BackupPC/CGI/DirHistory.pm index dfcac68..6fb0366 100644 --- a/lib/BackupPC/CGI/DirHistory.pm +++ b/lib/BackupPC/CGI/DirHistory.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -40,6 +40,7 @@ use strict; use BackupPC::CGI::Lib qw(:all); use BackupPC::View; use BackupPC::Attrib qw(:all); +use Encode; sub action { @@ -85,6 +86,7 @@ sub action my %inode2name; my $nameCnt = 0; (my $fDisp = "${EscHTML($f)}") =~ s/ / /g; + $fDisp = decode_utf8($fDisp); $fileStr .= "$fDisp"; my($colSpan, $url, $inode, $type); my $tdClass = ' class="histView"'; @@ -162,7 +164,7 @@ EOF $fileStr .= "\n"; } - my $dirDisplay = "$share/$dir"; + my $dirDisplay = decode_utf8("$share/$dir"); $dirDisplay =~ s{//+}{/}g; $dirDisplay =~ s{/+$}{}g; $dirDisplay = "/" if ( $dirDisplay eq "" ); diff --git a/lib/BackupPC/CGI/EditConfig.pm b/lib/BackupPC/CGI/EditConfig.pm index a5740e4..3504bc1 100644 --- a/lib/BackupPC/CGI/EditConfig.pm +++ b/lib/BackupPC/CGI/EditConfig.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -1130,7 +1130,7 @@ EOF if ( !$type->{noKeyEdit} ) { $content .= < -$Lang->{CfgEdit_Button_New_Key}: +$Lang->{CfgEdit_Button_New_Key}: EOF diff --git a/lib/BackupPC/CGI/EmailSummary.pm b/lib/BackupPC/CGI/EmailSummary.pm index 1b0fcf5..f36c806 100644 --- a/lib/BackupPC/CGI/EmailSummary.pm +++ b/lib/BackupPC/CGI/EmailSummary.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/GeneralInfo.pm b/lib/BackupPC/CGI/GeneralInfo.pm index 927b97d..99a3afc 100644 --- a/lib/BackupPC/CGI/GeneralInfo.pm +++ b/lib/BackupPC/CGI/GeneralInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/HostInfo.pm b/lib/BackupPC/CGI/HostInfo.pm index 583afa0..730d644 100644 --- a/lib/BackupPC/CGI/HostInfo.pm +++ b/lib/BackupPC/CGI/HostInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/LOGlist.pm b/lib/BackupPC/CGI/LOGlist.pm index a728c01..0cd27b2 100644 --- a/lib/BackupPC/CGI/LOGlist.pm +++ b/lib/BackupPC/CGI/LOGlist.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Lib.pm b/lib/BackupPC/CGI/Lib.pm index 502a83c..c776d3f 100644 --- a/lib/BackupPC/CGI/Lib.pm +++ b/lib/BackupPC/CGI/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Queue.pm b/lib/BackupPC/CGI/Queue.pm index b516acd..4223d8f 100644 --- a/lib/BackupPC/CGI/Queue.pm +++ b/lib/BackupPC/CGI/Queue.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/RSS.pm b/lib/BackupPC/CGI/RSS.pm index 61eeee4..b5d9ab1 100644 --- a/lib/BackupPC/CGI/RSS.pm +++ b/lib/BackupPC/CGI/RSS.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/ReloadServer.pm b/lib/BackupPC/CGI/ReloadServer.pm index 5e5dc2a..e644611 100644 --- a/lib/BackupPC/CGI/ReloadServer.pm +++ b/lib/BackupPC/CGI/ReloadServer.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Restore.pm b/lib/BackupPC/CGI/Restore.pm index 1f8a900..9f5cb05 100644 --- a/lib/BackupPC/CGI/Restore.pm +++ b/lib/BackupPC/CGI/Restore.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -112,6 +112,7 @@ EOF # # Tell the user what options they have # + $pathHdr = decode_utf8($pathHdr); $content .= eval("qq{$Lang->{Restore_Options_for__host2}}"); if ( @hosts == 1 ) { @@ -271,6 +272,8 @@ EOF $host:/$strippedShare$f$In{hostDest}:/$strippedShareDest$targetFile EOF } + $In{shareDest} = decode_utf8($In{shareDest}); + $In{pathHdr} = decode_utf8($In{pathHdr}); my $content = eval("qq{$Lang->{Are_you_sure}}"); Header(eval("qq{$Lang->{Restore_Confirm_on__host}}"), $content); Trailer(); diff --git a/lib/BackupPC/CGI/RestoreFile.pm b/lib/BackupPC/CGI/RestoreFile.pm index dfce7ef..e0fbe67 100644 --- a/lib/BackupPC/CGI/RestoreFile.pm +++ b/lib/BackupPC/CGI/RestoreFile.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -37,11 +37,13 @@ package BackupPC::CGI::RestoreFile; use strict; +use Encode; use BackupPC::CGI::Lib qw(:all); use BackupPC::FileZIO; use BackupPC::Attrib qw(:all); use BackupPC::View; + sub action { restoreFile($In{host}, $In{num}, $In{share}, $In{dir}); @@ -150,7 +152,8 @@ sub restoreFile my $view = BackupPC::View->new($bpc, $host, \@Backups); my $a = $view->fileAttrib($num, $share, $dir); if ( $dir =~ m{(^|/)\.\.(/|$)} || !defined($a) ) { - ErrorExit("Can't restore bad file ${EscHTML($dir)} ($num, $share, $dir)"); + $dir = decode_utf8($dir); + ErrorExit("Can't restore bad file ${EscHTML($dir)} ($num, $share)"); } my $f = BackupPC::FileZIO->open($a->{fullPath}, 0, $a->{compress}); my $data; diff --git a/lib/BackupPC/CGI/RestoreInfo.pm b/lib/BackupPC/CGI/RestoreInfo.pm index b092563..5b222f0 100644 --- a/lib/BackupPC/CGI/RestoreInfo.pm +++ b/lib/BackupPC/CGI/RestoreInfo.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/StartServer.pm b/lib/BackupPC/CGI/StartServer.pm index 2fe216d..dd643cc 100644 --- a/lib/BackupPC/CGI/StartServer.pm +++ b/lib/BackupPC/CGI/StartServer.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/StartStopBackup.pm b/lib/BackupPC/CGI/StartStopBackup.pm index 80f2df1..07b6456 100644 --- a/lib/BackupPC/CGI/StartStopBackup.pm +++ b/lib/BackupPC/CGI/StartStopBackup.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/StopServer.pm b/lib/BackupPC/CGI/StopServer.pm index b828c50..1baa907 100644 --- a/lib/BackupPC/CGI/StopServer.pm +++ b/lib/BackupPC/CGI/StopServer.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/Summary.pm b/lib/BackupPC/CGI/Summary.pm index c61538c..bd7f52e 100644 --- a/lib/BackupPC/CGI/Summary.pm +++ b/lib/BackupPC/CGI/Summary.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/CGI/View.pm b/lib/BackupPC/CGI/View.pm index 4676684..0f5ab98 100644 --- a/lib/BackupPC/CGI/View.pm +++ b/lib/BackupPC/CGI/View.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Config/Meta.pm b/lib/BackupPC/Config/Meta.pm index 137f957..fb134b9 100644 --- a/lib/BackupPC/Config/Meta.pm +++ b/lib/BackupPC/Config/Meta.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/FileZIO.pm b/lib/BackupPC/FileZIO.pm index ccf3dc0..016b513 100644 --- a/lib/BackupPC/FileZIO.pm +++ b/lib/BackupPC/FileZIO.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -248,7 +248,11 @@ sub readLine } } $str = shift(@{$self->{readLineBuf}}) . "\n"; - $str = decode_utf8($str) if ( $self->{utf8} ); + if ( $self->{utf8} ) { + my $strUtf8 = decode_utf8($str, 0); + $strUtf8 = $str if ( length($strUtf8) == 0 ); + return $strUtf8; + } return $str; } diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index 960c222..12cb6e1 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -94,7 +94,7 @@ sub new my $bpc = bless { %$paths, - Version => '3.0.0beta0', + Version => '3.0.0beta1', }, $class; $bpc->{storage} = BackupPC::Storage->new($paths); diff --git a/lib/BackupPC/PoolWrite.pm b/lib/BackupPC/PoolWrite.pm index c17cbee..cd6cf0f 100644 --- a/lib/BackupPC/PoolWrite.pm +++ b/lib/BackupPC/PoolWrite.pm @@ -56,7 +56,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Storage.pm b/lib/BackupPC/Storage.pm index 7c6a0e1..569ba36 100644 --- a/lib/BackupPC/Storage.pm +++ b/lib/BackupPC/Storage.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Storage/Text.pm b/lib/BackupPC/Storage/Text.pm index 4f63417..72b2fba 100644 --- a/lib/BackupPC/Storage/Text.pm +++ b/lib/BackupPC/Storage/Text.pm @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -451,12 +451,12 @@ sub HostInfoRead if ( @hdr ) { if ( defined($host) ) { next if ( lc($fld[0]) ne lc($host) ); - @{$hosts{$fld[0]}}{@hdr} = @fld; + @{$hosts{lc($fld[0])}}{@hdr} = @fld; close(HOST_INFO); close(LOCK); return \%hosts; } else { - @{$hosts{$fld[0]}}{@hdr} = @fld; + @{$hosts{lc($fld[0])}}{@hdr} = @fld; } } else { @hdr = @fld; diff --git a/lib/BackupPC/View.pm b/lib/BackupPC/View.pm index d879de2..f550b00 100644 --- a/lib/BackupPC/View.pm +++ b/lib/BackupPC/View.pm @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -140,7 +140,7 @@ sub dirCache } } foreach my $file ( @dir ) { - $file = $1 if ( $file =~ /(.*)/ ); + $file = $1 if ( $file =~ /(.*)/s ); my $fileUM = $file; $fileUM = $m->{bpc}->fileNameUnmangle($fileUM) if ( $mangle ); #print(STDERR "Doing $fileUM\n"); @@ -249,7 +249,7 @@ sub shareList my @dir = readdir(DIR); closedir(DIR); foreach my $file ( @dir ) { - $file = $1 if ( $file =~ /(.*)/ ); + $file = $1 if ( $file =~ /(.*)/s ); next if ( $file eq "attrib" && $mangle || $file eq "." || $file eq ".." @@ -289,7 +289,7 @@ sub fileAttrib my($m, $backupNum, $share, $path) = @_; #print(STDERR "fileAttrib($backupNum, $share, $path)\n"); - if ( $path =~ s{(.*)/+(.+)}{$1} ) { + if ( $path =~ s{(.*)/+(.+)}{$1}s ) { my $file = $2; $m->dirCache($backupNum, $share, $path); return $m->{files}{$file}; @@ -401,7 +401,7 @@ sub dirHistory } } foreach my $file ( @dir ) { - $file = $1 if ( $file =~ /(.*)/ ); + $file = $1 if ( $file =~ /(.*)/s ); my $fileUM = $file; $fileUM = $m->{bpc}->fileNameUnmangle($fileUM) if ( $mangle ); #print(STDERR "Doing $fileUM\n"); diff --git a/lib/BackupPC/Xfer/Archive.pm b/lib/BackupPC/Xfer/Archive.pm index 9da8e43..cd10031 100644 --- a/lib/BackupPC/Xfer/Archive.pm +++ b/lib/BackupPC/Xfer/Archive.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/BackupPCd.pm b/lib/BackupPC/Xfer/BackupPCd.pm index 7763ad7..76fa0be 100644 --- a/lib/BackupPC/Xfer/BackupPCd.pm +++ b/lib/BackupPC/Xfer/BackupPCd.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Rsync.pm b/lib/BackupPC/Xfer/Rsync.pm index 20e8b67..074d845 100644 --- a/lib/BackupPC/Xfer/Rsync.pm +++ b/lib/BackupPC/Xfer/Rsync.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -40,6 +40,7 @@ package BackupPC::Xfer::Rsync; use strict; use BackupPC::View; use BackupPC::Xfer::RsyncFileIO; +use Encode qw/from_to encode/; use vars qw( $RsyncLibOK $RsyncLibErr ); @@ -55,10 +56,10 @@ BEGIN { # # Note: also update configure.pl when this version number is changed! # - if ( $File::RsyncP::VERSION < 0.62 ) { + if ( $File::RsyncP::VERSION < 0.64 ) { $RsyncLibOK = 0; $RsyncLibErr = "File::RsyncP module version" - . " ($File::RsyncP::VERSION) too old: need 0.62"; + . " ($File::RsyncP::VERSION) too old: need 0.64"; } else { $RsyncLibOK = 1; } @@ -130,6 +131,8 @@ sub start $rsyncArgs = $conf->{RsyncRestoreArgs}; my $remoteDir = "$t->{shareName}/$t->{pathHdrDest}"; $remoteDir =~ s{//+}{/}g; + from_to($remoteDir, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $argList = ['--server', @$rsyncArgs, '.', $remoteDir]; $fioArgs = { client => $t->{bkupSrcHost}, @@ -197,9 +200,13 @@ sub start } } foreach my $file ( @inc ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, "--include=$file"); } foreach my $file ( @exc ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, "--exclude=$file"); } } @@ -209,6 +216,8 @@ sub start # # just append additional exclude lists onto the end # + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, "--exclude=$file"); } } @@ -241,8 +250,11 @@ sub start $rsyncArgs = [@$rsyncArgs, "--ignore-times"] if ( $t->{type} eq "full" ); $rsyncClientCmd = $conf->{RsyncClientCmd}; + my $shareNameSlash = $t->{shareNameSlash}; + from_to($shareNameSlash, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $argList = ['--server', '--sender', @$rsyncArgs, - '.', $t->{shareNameSlash}]; + '.', $shareNameSlash]; eval { $argList = File::RsyncP->excludeStrip($argList); }; @@ -267,6 +279,10 @@ sub start sshPath => $conf->{SshPath}, argList => $argList, }; + from_to($args->{shareName}, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); + from_to($args->{shareNameSlash}, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $rsyncClientCmd = $bpc->cmdVarSubstitute($rsyncClientCmd, $args); # @@ -351,6 +367,11 @@ sub run $remoteDir = $t->{shareNameSlash}; $remoteDirDaemon = "."; } + from_to($remoteDir, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); + from_to($remoteDirDaemon, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); + if ( $t->{XferMethod} eq "rsync" ) { # # Run rsync command @@ -358,6 +379,8 @@ sub run my $str = "Running: " . $t->{bpc}->execCmd2ShellCmd(@{$t->{rsyncClientCmd}}) . "\n"; + from_to($str, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); $t->{XferLOG}->write(\$str); $rs->remoteStart($remoteSend, $remoteDir); } else { @@ -378,6 +401,8 @@ sub run # my $module = $t->{shareName}; $module = $t->{shareNameSlash} if ( $module =~ /\// ); + from_to($module, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); if ( defined(my $err = $rs->serverService($module, $conf->{RsyncdUserName}, $conf->{RsyncdPasswd}, @@ -390,7 +415,10 @@ sub run } $rs->serverStart($remoteSend, $remoteDirDaemon); } - my $error = $rs->go($t->{shareNameSlash}); + my $shareNameSlash = $t->{shareNameSlash}; + from_to($shareNameSlash, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); + my $error = $rs->go($shareNameSlash); $rs->serverClose(); # diff --git a/lib/BackupPC/Xfer/RsyncDigest.pm b/lib/BackupPC/Xfer/RsyncDigest.pm index 8846340..2a1611c 100644 --- a/lib/BackupPC/Xfer/RsyncDigest.pm +++ b/lib/BackupPC/Xfer/RsyncDigest.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/RsyncFileIO.pm b/lib/BackupPC/Xfer/RsyncFileIO.pm index ea72dce..1c89ab9 100644 --- a/lib/BackupPC/Xfer/RsyncFileIO.pm +++ b/lib/BackupPC/Xfer/RsyncFileIO.pm @@ -12,7 +12,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -328,7 +328,7 @@ sub attribGetWhere $fname = "$fio->{xfer}{pathHdrSrc}/$fname" if ( defined($fio->{xfer}{pathHdrSrc}) ); $fname =~ s{//+}{/}g; - if ( $fname =~ m{(.*)/(.*)} ) { + if ( $fname =~ m{(.*)/(.*)}s ) { $shareM = $fio->{shareM}; $dir = $1; $fname = $2; @@ -437,7 +437,7 @@ sub attribSet my($fio, $f, $placeHolder) = @_; my($dir, $file); - if ( $f->{name} =~ m{(.*)/(.*)} ) { + if ( $f->{name} =~ m{(.*)/(.*)}s ) { $file = $2; $dir = "$fio->{shareM}/" . $1; } elsif ( $f->{name} eq "." ) { @@ -517,7 +517,7 @@ sub attribWrite my $dir; my $share; - $dir = $1 if ( $d =~ m{.+?/(.*)} ); + $dir = $1 if ( $d =~ m{.+?/(.*)}s ); $fio->viewCacheDir(undef, $dir); ##print("attribWrite $d,$dir\n"); ##$Data::Dumper::Indent = 1; @@ -529,7 +529,7 @@ sub attribWrite if ( defined($fio->{viewCache}{$d}) ) { foreach my $f ( keys(%{$fio->{viewCache}{$d}}) ) { my $name = $f; - $name = "$1/$name" if ( $d =~ m{.*?/(.*)} ); + $name = "$1/$name" if ( $d =~ m{.*?/(.*)}s ); if ( defined(my $a = $fio->{attrib}{$d}->get($f)) ) { # # delete temporary attributes (skipped files) @@ -565,7 +565,7 @@ sub attribWrite my $dirM = $d; $dirM = $1 . "/" . $fio->{bpc}->fileNameMangle($2) - if ( $dirM =~ m{(.*?)/(.*)} ); + if ( $dirM =~ m{(.*?)/(.*)}s ); my $fileName = $fio->{attrib}{$d}->fileName("$fio->{outDir}$dirM"); $fio->log("attribWrite(dir=$d) -> $fileName") if ( $fio->{logLevel} >= 4 ); @@ -615,7 +615,7 @@ sub statsGet sub makePath { my($fio, $f) = @_; - my $name = $1 if ( $f->{name} =~ /(.*)/ ); + my $name = $1 if ( $f->{name} =~ /(.*)/s ); my $path; if ( $name eq "." ) { @@ -625,7 +625,7 @@ sub makePath } $fio->logFileAction("create", $f) if ( $fio->{logLevel} >= 1 ); $fio->log("makePath($path, 0777)") if ( $fio->{logLevel} >= 5 ); - $path = $1 if ( $path =~ /(.*)/ ); + $path = $1 if ( $path =~ /(.*)/s ); File::Path::mkpath($path, 0, 0777) if ( !-d $path ); return $fio->attribSet($f) if ( -d $path ); $fio->log("Can't create directory $path"); @@ -639,7 +639,7 @@ sub makePath sub makeSpecial { my($fio, $f) = @_; - my $name = $1 if ( $f->{name} =~ /(.*)/ ); + my $name = $1 if ( $f->{name} =~ /(.*)/s ); my $fNameM = $fio->{bpc}->fileNameMangle($name); my $path = $fio->{outDirSh} . $fNameM; my $attr = $fio->attribGet($f); @@ -912,7 +912,7 @@ sub fileDeltaRxNext # need to open an output file where we will build the # new version. # - $fio->{rxFile}{name} =~ /(.*)/; + $fio->{rxFile}{name} =~ /(.*)/s; my $rxOutFileRel = "$fio->{shareM}/" . $fio->{bpc}->fileNameMangle($1); my $rxOutFile = $fio->{outDir} . $rxOutFileRel; $fio->{rxOutFd} = BackupPC::PoolWrite->new($fio->{bpc}, @@ -1079,7 +1079,7 @@ sub fileDeltaRxNext sub fileDeltaRxDone { my($fio, $md4, $phase) = @_; - my $name = $1 if ( $fio->{rxFile}{name} =~ /(.*)/ ); + my $name = $1 if ( $fio->{rxFile}{name} =~ /(.*)/s ); my $ret; close($fio->{rxInFd}) if ( defined($fio->{rxInFd}) ); @@ -1358,7 +1358,7 @@ sub fileListEltSend if ( $fio->{clientCharset} ne "" ); $fList->encode($f); - $logName = "$fio->{xfer}{pathHdrDest}/$f->{name}"; + $logName = "$fio->{xfer}{pathHdrDest}/$logName"; $logName =~ s{//+}{/}g; $f->{name} = $logName; $fio->logFileAction("restore", $f) if ( $fio->{logLevel} >= 1 ); diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index c9242f4..03c983c 100644 --- a/lib/BackupPC/Xfer/Smb.pm +++ b/lib/BackupPC/Xfer/Smb.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -38,6 +38,7 @@ package BackupPC::Xfer::Smb; use strict; +use Encode qw/from_to encode/; sub new { @@ -111,12 +112,16 @@ sub start $t->{fileIncludeHash} = {}; if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); $t->{fileIncludeHash}{$file} = 1; } } elsif ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); } # @@ -151,6 +156,8 @@ sub start X_option => $X_option, timeStampFile => $timeStampFile, }; + from_to($args->{shareName}, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $smbClientCmd = $bpc->cmdVarSubstitute($smbClientCmd, $args); if ( !defined($t->{xferPid} = open(SMB, "-|")) ) { @@ -193,6 +200,8 @@ sub start return; } my $str = "Running: " . $bpc->execCmd2ShellCmd(@$smbClientCmd) . "\n"; + from_to($str, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); $t->{XferLOG}->write(\$str); alarm($conf->{ClientTimeout}); $t->{_errStr} = undef; @@ -229,6 +238,9 @@ sub readOutput # alarm($conf->{ClientTimeout}) if ( !$t->{abort} ); $t->{lastOutputLine} = $_ if ( !/^$/ ); + + from_to($_, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); # # This section is highly dependent on the version of smbclient. # If you upgrade Samba, make sure that these regexp are still valid. diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index c78ff53..004808d 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -38,6 +38,7 @@ package BackupPC::Xfer::Tar; use strict; +use Encode qw/from_to encode/; sub new { @@ -100,13 +101,19 @@ sub start if ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) { - $file = ".$file" if ( $file =~ /^\// ); + $file = $2 if ( $file =~ m{^(\./+|/+)(.*)}s ); + $file = "./$file"; + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, "--exclude=$file"); } } if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) { - $file = ".$file" if ( $file =~ /^\// ); + $file = $2 if ( $file =~ m{^(\./+|/+)(.*)}s ); + $file = "./$file"; + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); } } else { @@ -143,6 +150,8 @@ sub start tarPath => $conf->{TarClientPath}, sshPath => $conf->{SshPath}, }; + from_to($args->{shareName}, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $tarClientCmd = $bpc->cmdVarSubstitute($tarClientCmd, $args); if ( !defined($t->{xferPid} = open(TAR, "-|")) ) { $t->{_errStr} = "Can't fork to run tar"; @@ -184,6 +193,8 @@ sub start return; } my $str = "Running: " . $bpc->execCmd2ShellCmd(@$tarClientCmd) . "\n"; + from_to($str, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); $t->{XferLOG}->write(\"Running: @$tarClientCmd\n"); alarm($conf->{ClientTimeout}); $t->{_errStr} = undef; @@ -207,9 +218,12 @@ sub readOutput $t->{tarOut} .= $mesg; } } + my $logFileThres = $t->{type} eq "restore" ? 1 : 2; while ( $t->{tarOut} =~ /(.*?)[\n\r]+(.*)/s ) { $_ = $1; $t->{tarOut} = $2; + from_to($_, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); # # refresh our inactivity alarm # @@ -219,7 +233,7 @@ sub readOutput $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 ); $t->{xferOK} = 1; } elsif ( /^\./ ) { - $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 ); + $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= $logFileThres ); $t->{fileCnt}++; } else { # diff --git a/lib/BackupPC/Zip/FileMember.pm b/lib/BackupPC/Zip/FileMember.pm index 7be7d6d..ed284fd 100644 --- a/lib/BackupPC/Zip/FileMember.pm +++ b/lib/BackupPC/Zip/FileMember.pm @@ -33,7 +33,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # diff --git a/makeDist b/makeDist index 6c081e5..13dd9cf 100755 --- a/makeDist +++ b/makeDist @@ -53,8 +53,8 @@ die("BackupPC::Lib->new failed\n") umask(0022); -my $Version = "3.0.0beta0"; -my $ReleaseDate = "11 Jul 2006"; +my $Version = "3.0.0beta1"; +my $ReleaseDate = "30 Jul 2006"; my $DistDir = "dist/BackupPC-$Version"; my @PerlSrc = qw( -- 2.20.1