From 74dc9d456332757127d5eda4ce32f29377133fa2 Mon Sep 17 00:00:00 2001 From: cbarratt Date: Sun, 1 Jun 2003 18:55:55 +0000 Subject: [PATCH] * Several improvements to restore: cancel now reports the correct message and cleans up correctly. * Rsync with whitespace and wildcard excludes fixed by replacing argList with argList+ in config.pl. * Fixed typo in bin/BackupPC_restore (XferLOG -> RestoreLOG). * (Re)-fixed "Bad command" in log file when restore via tar or zip file download is done. * Added untaint to exec in Lib.pm to avoid tainted errors. * Applied additional tweak to hilight patch from Tim Demarest. * $Conf{CgiAdminUsers} = '*' now allows privileged even with REMOTE_USER not set. * Don't display RsyncdPasswd when displaying config.pl files. * Replace pipe with socketpair in bin/BackupPC_dump and bin/BackupPC_restore, which increases typical buffering from 4K to 16K-64K. This improves the performance. * Add check on $ENV{LANG} setting do configure.pl: if LANG includes utf then a warning is printed. --- ChangeLog | 31 +++++++ bin/BackupPC | 50 +++++++++--- bin/BackupPC_compressPool | 2 +- bin/BackupPC_dump | 31 +++++-- bin/BackupPC_link | 2 +- bin/BackupPC_nightly | 2 +- bin/BackupPC_restore | 62 +++++++++----- bin/BackupPC_sendEmail | 2 +- bin/BackupPC_serverMesg | 2 +- bin/BackupPC_tarCreate | 2 +- bin/BackupPC_tarExtract | 2 +- bin/BackupPC_trashClean | 2 +- bin/BackupPC_zcat | 2 +- bin/BackupPC_zipCreate | 2 +- cgi-bin/BackupPC_Admin | 22 +++-- conf/config.pl | 39 +++++++-- configure.pl | 14 ++++ doc-src/BackupPC.pod | 135 +++++++++++++++++++++++++++---- lib/BackupPC/Attrib.pm | 2 +- lib/BackupPC/FileZIO.pm | 2 +- lib/BackupPC/Lang/de.pm | 13 +-- lib/BackupPC/Lang/en.pm | 11 +-- lib/BackupPC/Lang/es.pm | 11 +-- lib/BackupPC/Lang/fr.pm | 12 +-- lib/BackupPC/Lib.pm | 10 +-- lib/BackupPC/PoolWrite.pm | 2 +- lib/BackupPC/View.pm | 2 +- lib/BackupPC/Xfer/Rsync.pm | 2 +- lib/BackupPC/Xfer/RsyncFileIO.pm | 37 +++++---- lib/BackupPC/Xfer/Smb.pm | 2 +- lib/BackupPC/Xfer/Tar.pm | 2 +- lib/BackupPC/Zip/FileMember.pm | 2 +- makeDist | 4 +- 33 files changed, 377 insertions(+), 141 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4789d2e..bdfa741 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,37 @@ # Version __VERSION__, __RELEASEDATE__ #------------------------------------------------------------------------ +* Several improvements to restore: cancel now reports the correct + message and cleans up correctly. + +* Rsync with whitespace and wildcard excludes fixed by replacing + argList with argList+ in config.pl. + +* Fixed typo in bin/BackupPC_restore (XferLOG -> RestoreLOG). + +* (Re)-fixed "Bad command" in log file when restore via tar or zip + file download is done. + +* Added untaint to exec in Lib.pm to avoid tainted errors. + +* Applied additional tweak to hilight patch from Tim Demarest. + +* $Conf{CgiAdminUsers} = '*' now allows privileged even with REMOTE_USER + not set. + +* Don't display RsyncdPasswd when displaying config.pl files. + +* Replace pipe with socketpair in bin/BackupPC_dump and bin/BackupPC_restore, + which increases typical buffering from 4K to 16K-64K. This improves the + performance. + +* Add check on $ENV{LANG} setting do configure.pl: if LANG includes utf + then a warning is printed. + +#------------------------------------------------------------------------ +# Version 2.0.0beta2, 11 May 2003 +#------------------------------------------------------------------------ + * Added German translation, provided by Manfred Herrmann. * Fixed large-file problem with rsync, reported by Manfred Herrmann. diff --git a/bin/BackupPC b/bin/BackupPC index bec909d..e6bc5f1 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -661,9 +661,16 @@ sub Main_Process_Signal $NextWakeup = 0; } elsif ( $SigName ) { print(LOG $bpc->timeStamp, "Got signal $SigName... cleaning up\n"); - foreach my $host ( keys(%Jobs) ) { - kill(2, $Jobs{$host}{pid}); - } + if ( keys(%Jobs) ) { + foreach my $host ( keys(%Jobs) ) { + kill(2, $Jobs{$host}{pid}); + } + sleep(1); + foreach my $host ( keys(%Jobs) ) { + kill(9, $Jobs{$host}{pid}); + } + %Jobs = (); + } StatusWrite(); unlink("$TopDir/log/BackupPC.pid"); exit(1); @@ -845,9 +852,12 @@ sub Main_Check_Job_Messages delete($Status{$host}{errorTime}); $Status{$host}{endTime} = time; } elsif ( $mesg =~ /^nothing to do/ ) { - $Status{$host}{state} = "Status_idle"; - $Status{$host}{reason} = "Reason_nothing_to_do"; - $Status{$host}{startTime} = time; + if ( $Status{$host}{reason} ne "Reason_backup_failed" + && $Status{$host}{reason} ne "Reason_restore_failed" ) { + $Status{$host}{state} = "Status_idle"; + $Status{$host}{reason} = "Reason_nothing_to_do"; + $Status{$host}{startTime} = time; + } $Status{$host}{dhcpCheckCnt}-- if ( $Status{$host}{dhcpCheckCnt} > 0 ); } elsif ( $mesg =~ /^no ping response/ @@ -871,7 +881,14 @@ sub Main_Check_Job_Messages $Status{$host}{error} = $1; $Status{$host}{errorTime} = time; $Status{$host}{endTime} = time; - print(LOG $bpc->timeStamp, "backup failed on $host ($1)\n"); + print(LOG $bpc->timeStamp, "Backup failed on $host ($1)\n"); + } elsif ( $mesg =~ /^restore failed: (.*)/ ) { + $Status{$host}{state} = "Status_idle"; + $Status{$host}{reason} = "Reason_restore_failed"; + $Status{$host}{error} = $1; + $Status{$host}{errorTime} = time; + $Status{$host}{endTime} = time; + print(LOG $bpc->timeStamp, "Restore failed on $host ($1)\n"); } elsif ( $mesg =~ /^log\s+(.*)/ ) { print(LOG $bpc->timeStamp, "$1\n"); } elsif ( $mesg =~ /^BackupPC_stats = (.*)/ ) { @@ -1021,7 +1038,7 @@ sub Main_Check_Client_Messages if ( $CmdJob ne $host && defined($Status{$host}) && defined($Jobs{$host}) ) { print(LOG $bpc->timeStamp, - "Stopping current backup of $host," + "Stopping current $Jobs{$host}{type} of $host," . " request by $user (backoff=$backoff)\n"); kill(2, $Jobs{$host}{pid}); # @@ -1033,11 +1050,17 @@ sub Main_Check_Client_Messages ##close($Jobs{$host}{fh}); ##delete($Jobs{$host}); - $Status{$host}{state} = "Status_idle"; - $Status{$host}{reason} = "Reason_backup_canceled_by_user"; + $Status{$host}{state} = "Status_idle"; + if ( $Jobs{$host}{type} eq "restore" ) { + $Status{$host}{reason} + = "Reason_restore_canceled_by_user"; + } else { + $Status{$host}{reason} + = "Reason_backup_canceled_by_user"; + } $Status{$host}{activeJob} = 0; $Status{$host}{startTime} = time; - $reply = "ok: backup of $host cancelled"; + $reply = "ok: $Jobs{$host}{type} of $host cancelled"; } elsif ( $BgQueueOn{$host} || $UserQueueOn{$host} ) { print(LOG $bpc->timeStamp, "Stopping pending backup of $host," @@ -1426,8 +1449,9 @@ sub catch_signal print(LOG "Fatal error: unhandled signal $SigName\n"); unlink("$TopDir/log/BackupPC.pid"); confess("Got new signal $SigName... quitting\n"); + } else { + $SigName = shift; } - $SigName = shift; } # diff --git a/bin/BackupPC_compressPool b/bin/BackupPC_compressPool index 998f35f..3796c75 100755 --- a/bin/BackupPC_compressPool +++ b/bin/BackupPC_compressPool @@ -49,7 +49,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index 8d27db3..928dc50 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -70,7 +70,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -83,6 +83,7 @@ use BackupPC::FileZIO; use BackupPC::Xfer::Smb; use BackupPC::Xfer::Tar; use BackupPC::Xfer::Rsync; +use Socket; use File::Path; use Getopt::Std; @@ -146,7 +147,8 @@ if ( $opts{d} ) { $Hosts = $bpc->HostInfoRead($client); } if ( !defined($Hosts->{$client}) ) { - print("Exiting because host $client does not exist in the hosts file\n"); + print("Exiting because host $client does not exist in the hosts file\n") + if ( $opts{v} ); exit(1) } @@ -445,12 +447,22 @@ for my $shareName ( @$ShareNames ) { # This xfer method outputs a tar format file, so we start a # BackupPC_tarExtract to extract the data. # - # Create a pipe to connect the Xfer method to BackupPC_tarExtract + # Create a socketpair to connect the Xfer method to BackupPC_tarExtract # WH is the write handle for writing, provided to the transport - # program, and RH is the other end of the pipe for reading, + # program, and RH is the other end of the socket for reading, # provided to BackupPC_tarExtract. # - pipe(RH, WH); + if ( socketpair(RH, WH, AF_UNIX, SOCK_STREAM, PF_UNSPEC) ) { + shutdown(RH, 1); # no writing to this socket + shutdown(WH, 0); # no reading from this socket + setsockopt(RH, SOL_SOCKET, SO_RCVBUF, 8 * 65536); + setsockopt(WH, SOL_SOCKET, SO_SNDBUF, 8 * 65536); + } else { + # + # Default to pipe() if socketpair() doesn't work. + # + pipe(RH, WH); + } # # fork a child for BackupPC_tarExtract. TAR is a file handle @@ -600,7 +612,7 @@ for my $shareName ( @$ShareNames ) { # the transfer. # if ( my $errMsg = CorrectHostCheck($hostIP, $host) ) { - $stat{hostError} = $errMsg; + $stat{hostError} = $errMsg if ( $stat{hostError} eq "" ); last SCAN; } } @@ -807,7 +819,12 @@ sub catch_signal my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : ""; # - # Ignore signals in children + # Children quit quietly on ALRM + # + exit(1) if ( $Pid != $$ && $signame eq "ALRM" ); + + # + # Ignore other signals in children # return if ( $Pid != $$ ); diff --git a/bin/BackupPC_link b/bin/BackupPC_link index 44dbccb..7450f28 100755 --- a/bin/BackupPC_link +++ b/bin/BackupPC_link @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_nightly b/bin/BackupPC_nightly index 146b6db..e4eb3cc 100755 --- a/bin/BackupPC_nightly +++ b/bin/BackupPC_nightly @@ -35,7 +35,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index f63882b..1186cac 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -42,6 +42,7 @@ use BackupPC::FileZIO; use BackupPC::Xfer::Smb; use BackupPC::Xfer::Tar; use BackupPC::Xfer::Rsync; +use Socket; use File::Path; use Getopt::Std; @@ -88,6 +89,11 @@ my $tarPid = -1; $SIG{INT} = \&catch_signal; $SIG{ALRM} = \&catch_signal; $SIG{TERM} = \&catch_signal; +$SIG{PIPE} = \&catch_signal; +$SIG{STOP} = \&catch_signal; +$SIG{TSTP} = \&catch_signal; +$SIG{TTIN} = \&catch_signal; +my $Pid = $$; mkpath($Dir, 0, 0777) if ( !-d $Dir ); if ( !-f "$Dir/LOCK" ) { @@ -224,13 +230,23 @@ my $useTar = $xfer->useTar; if ( $useTar ) { # - # Create a pipe to connect BackupPC_tarCreate to the transport program - # (smbclient, tar, etc). + # Create a socketpair to connect BackupPC_tarCreate to the transport + # program (smbclient, tar, etc). # WH is the write handle for writing, provided to BackupPC_tarCreate # and RH is the other end of the pipe for reading provided to the # transport program. # - pipe(RH, WH); + if ( socketpair(RH, WH, AF_UNIX, SOCK_STREAM, PF_UNSPEC) ) { + shutdown(RH, 1); # no writing to this socket + shutdown(WH, 0); # no reading from this socket + setsockopt(RH, SOL_SOCKET, SO_RCVBUF, 8 * 65536); + setsockopt(WH, SOL_SOCKET, SO_SNDBUF, 8 * 65536); + } else { + # + # Default to pipe() if socketpair() doesn't work. + # + pipe(RH, WH); + } } # @@ -434,22 +450,29 @@ sub catch_signal { my $signame = shift; + # + # Children quit quietly on ALRM + # + exit(1) if ( $Pid != $$ && $signame eq "ALRM" ); + + # + # Ignore signals in children + # + return if ( $Pid != $$ ); + # # Note: needs to be tested for each kind of XferMethod # print(LOG $bpc->timeStamp, "cleaning up after signal $signame\n"); - if ( @xferPid ) { - kill(2, @xferPid); - sleep(1); - kill(9, @xferPid); - } - if ( $tarPid > 0 ) { - kill(2, $tarPid); - sleep(1); - kill(9, $tarPid); - } + $SIG{$signame} = 'IGNORE'; + $RestoreLOG->write(\"exiting after signal $signame\n"); $stat{xferOK} = 0; - $stat{hostError} = "aborted by signal $signame"; + if ( $signame eq "INT" ) { + $stat{hostError} = "aborted by user (signal=$signame)"; + } else { + $stat{hostError} = "aborted by signal=$signame"; + } + exit(RestoreCleanup($client)); } # @@ -502,7 +525,6 @@ sub RestoreCleanup # UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd ); - $RestoreLOG->close() if ( defined($RestoreLOG) ); rename("$Dir/RestoreLOG$fileExt", "$Dir/RestoreLOG.$lastNum$fileExt"); rename("$Dir/$reqFileName", "$Dir/RestoreInfo.$lastNum"); my $endTime = time(); @@ -523,8 +545,12 @@ sub RestoreCleanup if ( $stat{hostAbort} && $stat{hostError} eq "" ) { $stat{hostError} = "lost network connection during restore"; } + $RestoreLOG->write(\"Restore failed: $stat{hostError}\n") + if ( defined($RestoreLOG) ); } + $RestoreLOG->close() if ( defined($RestoreLOG) ); + # # Add the new restore information to the restore file # @@ -550,7 +576,7 @@ sub RestoreCleanup $bpc->RestoreInfoWrite($client, @Restores); if ( !$stat{xferOK} ) { - print(LOG $bpc->timeStamp, "Restore aborted ($stat{hostError})\n"); + print(LOG $bpc->timeStamp, "Restore failed ($stat{hostError})\n"); print("restore failed: $stat{hostError}\n"); return 1; } else { @@ -572,7 +598,7 @@ sub pidHandler my @pids = @xferPid; push(@pids, $tarPid) if ( $tarPid > 0 ); my $str = join(",", @pids); - $XferLOG->write(\"Xfer PIDs are now $str\n") if ( defined($XferLOG) ); + $RestoreLOG->write(\"Xfer PIDs are now $str\n") if ( defined($RestoreLOG) ); print("xferPids $str\n"); } diff --git a/bin/BackupPC_sendEmail b/bin/BackupPC_sendEmail index f30c0d3..9131081 100755 --- a/bin/BackupPC_sendEmail +++ b/bin/BackupPC_sendEmail @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_serverMesg b/bin/BackupPC_serverMesg index 672c5b9..e84cd42 100755 --- a/bin/BackupPC_serverMesg +++ b/bin/BackupPC_serverMesg @@ -43,7 +43,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarCreate b/bin/BackupPC_tarCreate index d2fd623..9966469 100755 --- a/bin/BackupPC_tarCreate +++ b/bin/BackupPC_tarCreate @@ -48,7 +48,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarExtract b/bin/BackupPC_tarExtract index bdd506b..0508092 100755 --- a/bin/BackupPC_tarExtract +++ b/bin/BackupPC_tarExtract @@ -27,7 +27,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_trashClean b/bin/BackupPC_trashClean index 43abbf6..193528f 100755 --- a/bin/BackupPC_trashClean +++ b/bin/BackupPC_trashClean @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zcat b/bin/BackupPC_zcat index 655a41d..223b78a 100755 --- a/bin/BackupPC_zcat +++ b/bin/BackupPC_zcat @@ -32,7 +32,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zipCreate b/bin/BackupPC_zipCreate index 5b48622..c5fe37c 100755 --- a/bin/BackupPC_zipCreate +++ b/bin/BackupPC_zipCreate @@ -51,7 +51,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/cgi-bin/BackupPC_Admin b/cgi-bin/BackupPC_Admin index d61bdb1..906b4bb 100755 --- a/cgi-bin/BackupPC_Admin +++ b/cgi-bin/BackupPC_Admin @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 11 May 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -204,7 +204,8 @@ sub Action_Summary $incrTot += $incrCnt; $fullSize = sprintf("%.2f", $fullSize / 1000); $incrAge = " " if ( $incrAge eq "" ); - $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}}; + $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} + || $Conf{CgiStatusHilightColor}{$Status{$host}{state}}; $reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" ); if ( $Status{$host}{state} ne "Status_backup_in_progress" && $Status{$host}{state} ne "Status_restore_in_progress" @@ -471,6 +472,7 @@ sub Action_View # remove any passwords and user names s/(SmbSharePasswd.*=.*['"]).*(['"])/$1$2/ig; s/(SmbShareUserName.*=.*['"]).*(['"])/$1$2/ig; + s/(RsyncdPasswd.*=.*['"]).*(['"])/$1$2/ig; s/(ServerMesgSecret.*=.*['"]).*(['"])/$1$2/ig; print ${EscHTML($_)}; } @@ -883,7 +885,9 @@ EOF if ( @fileListTrim > 10 ) { @fileListTrim = (@fileListTrim[0..9], '...'); } - $bpc->ServerMesg(eval("qq{$Lang->{log_User__User_downloaded_tar_archive_for__host}}")); + $bpc->ServerMesg("log User $User downloaded tar archive for $host," + . " backup $num; files were: " + . join(", ", @fileListTrim)); my @pathOpts; if ( $In{relative} ) { @@ -917,7 +921,9 @@ EOF if ( @fileListTrim > 10 ) { @fileListTrim = (@fileListTrim[0..9], '...'); } - $bpc->ServerMesg(eval("qq{$Lang->{log_User__User_downloaded_zip_archive_for__host}}")); + $bpc->ServerMesg("log User $User downloaded zip archive for $host," + . " backup $num; files were: " + . join(", ", @fileListTrim)); my @pathOpts; if ( $In{relative} ) { @@ -1434,6 +1440,7 @@ EOF } foreach my $host ( sort(keys(%Status)) ) { next if ( $Status{$host}{reason} ne "Reason_backup_failed" + && $Status{$host}{reason} ne "Reason_restore_failed" && (!$Status{$host}{userReq} || $Status{$host}{reason} ne "Reason_no_ping") ); my $startTime = timeStamp2($Status{$host}{startTime}); @@ -1698,7 +1705,8 @@ sub CheckPermission my($host) = @_; my $Privileged = 0; - return 0 if ( $User eq "" || ($host ne "" && !defined($Hosts->{$host})) ); + return 0 if ( $User eq "" && $Conf{CgiAdminUsers} ne "*" + || $host ne "" && !defined($Hosts->{$host}) ); if ( $Conf{CgiAdminUserGroup} ne "" ) { my($n,$p,$gid,$mem) = getgrnam($Conf{CgiAdminUserGroup}); $Privileged ||= ($mem =~ /\b$User\b/); @@ -1835,7 +1843,7 @@ EOF } NavSectionTitle($Lang->{Hosts}); if ( defined($Hosts) && %$Hosts > 0 ) { - NavSectionStart(0); + NavSectionStart(1); foreach my $host ( GetUserHosts() ) { NavLink("?host=${EscURI($host)}", $host); } @@ -1891,7 +1899,7 @@ sub NavSectionStart { my($padding) = @_; - $padding = 2 if ( !defined($padding) ); + $padding = 1 if ( !defined($padding) ); print < EOF diff --git a/conf/config.pl b/conf/config.pl index 54e0f5b..8257ac1 100644 --- a/conf/config.pl +++ b/conf/config.pl @@ -263,7 +263,7 @@ $Conf{SmbShareName} = 'C$'; $Conf{SmbShareUserName} = ''; # -# Smbclient share password. This is passed to smbclient via the PASSWD +# Smbclient share password. This is passed to smbclient via its PASSWD # environment variable. There are several ways you can tell BackupPC # the smb share password. In each case you should be very careful about # security. If you put the password here, make sure that this file is @@ -315,6 +315,22 @@ $Conf{TarShareName} = '/'; # time taken for the backup, plus the granularity of $Conf{WakeupSchedule} # will make the actual backup interval a bit longer. # +# There are two special values for $Conf{FullPeriod}: +# +# -1 Don't do any regular backups on this machine. Manually +# requested backups (via the CGI interface) will still occur. +# +# -2 Don't do any backups on this machine. Manually requested +# backups (via the CGI interface) will be ignored. +# +# These special settings are useful for a client that is no longer +# being backed up (eg: a retired machine), but you wish to keep the +# last backups available for browsing or restoring to other machines. +# +# Also, you might create a virtual client (by setting $Conf{ClientNameAlias}) +# for restoring to a DVD or permanent media and you would set +# $Conf{FullPeriod} to -2 so that it is never backed up. +# $Conf{FullPeriod} = 6.97; # @@ -469,7 +485,7 @@ $Conf{BackupFilesOnly} = undef; # $Conf{BackupFilesExclude} = { # 'c' => ['/temp', '/winnt/tmp'], # these are for 'c' share # 'd' => ['/junk', '/dont_back_this_up'], # these are for 'd' share -# } +# }; # $Conf{BackupFilesExclude} = undef; @@ -704,7 +720,7 @@ $Conf{RsyncClientPath} = '/bin/rsync'; # # This setting only matters if $Conf{XferMethod} = 'rsync'. # -$Conf{RsyncClientCmd} = '$sshPath -l root $host $rsyncPath $argList'; +$Conf{RsyncClientCmd} = '$sshPath -l root $host $rsyncPath $argList+'; # # Full command to run rsync for restore on the client. The following @@ -721,7 +737,7 @@ $Conf{RsyncClientCmd} = '$sshPath -l root $host $rsyncPath $argList'; # # This setting only matters if $Conf{XferMethod} = 'rsync'. # -$Conf{RsyncClientRestoreCmd} = '$sshPath -l root $host $rsyncPath $argList'; +$Conf{RsyncClientRestoreCmd} = '$sshPath -l root $host $rsyncPath $argList+'; # # Share name to backup. For $Conf{XferMethod} = "rsync" this should @@ -864,7 +880,7 @@ $Conf{NmbLookupCmd} = '$nmbLookupPath -A $host'; # # NmbLookup command. Given a netbios name, finds that host by doing -# a NetBios multicast. Several variables are substituted at run-time: +# a NetBios lookup. Several variables are substituted at run-time: # # $nmbLookupPath path to nmblookup ($Conf{NmbLookupPath}) # $host NetBios name @@ -876,6 +892,17 @@ $Conf{NmbLookupCmd} = '$nmbLookupPath -A $host'; # # $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath -B 192.168.1.255 $host'; # +# If you use a WINS server and your machines don't respond to +# multicast NetBios requests you can use this (replace 1.2.3.4 +# with the IP address of your WINS server): +# +# $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath -R -U 1.2.3.4 $host'; +# +# This is preferred over multicast since it minimizes network traffic. +# +# Experiment manually for your site to see what form of nmblookup command +# works. +# $Conf{NmbLookupFindHostCmd} = '$nmbLookupPath $host'; # @@ -1256,8 +1283,8 @@ $Conf{CgiStatusHilightColor} = { Reason_backup_failed => '#ffcccc', Reason_backup_done => '#ccffcc', Reason_no_ping => '#ffff99', - Reason_backup_in_progress => '#66cc99', Reason_backup_canceled_by_user => '#ff9900', + Status_backup_in_progress => '#66cc99', }; # diff --git a/configure.pl b/configure.pl index ff910d0..b98bccc 100755 --- a/configure.pl +++ b/configure.pl @@ -599,6 +599,20 @@ will need to do: Enjoy! EOF +if ( $ENV{LANG} =~ /utf/i && $^V ge v5.8.0 ) { + print <. +version 5.6.0, 5.6.1 and 5.8.0. If you don't have perl, please +see L. =item * @@ -441,7 +441,7 @@ If you are using tar to backup linux/unix machines you should have version 1.13.7 at a minimum, with version 1.13.20 or higher recommended. Use "tar --version" to check your version. Various GNU mirrors have the newest versions of tar, see for example L. -As of February 2003 the latest version is 1.13.25. +As of June 2003 the latest version is 1.13.25. =item * @@ -451,7 +451,7 @@ Use "rsync --version" to check your version. For BackupPC to use Rsync you will also need to install the perl File::RsyncP module, which is available from -L. Version 0.31 or later is required. +L. Version 0.41 or later is required. =item * @@ -531,7 +531,7 @@ You can run "perldoc Archive::Zip" to see if this module is installed. To use rsync and rsyncd with BackupPC you will need to install File::RsyncP. You can run "perldoc File::RsyncP" to see if this module is installed. File::RsyncP is available from L. -Version 0.31 or later is required. +Version 0.41 or later is required. =back @@ -1261,8 +1261,6 @@ to Apache's 1.x httpd.conf file: -For Apache 2.x and perl 5.8.x - Apache 2.0.44 with Perl 5.8.0 on RedHat 7.1, Don Silvia reports that this works: @@ -1323,9 +1321,14 @@ One alternative is to use LDAP. In Apache's http.conf add these lines: require valid-user -If you want to defeat the user authentication you can force a -particular user name by getting Apache to set REMOTE_USER, eg, -to hardcode the user to www you could add this to httpd.conf: +If you want to disable the user authentication you can set +$Conf{CgiAdminUsers} to '*', which allows any user to have +full access to all hosts and backups. In this case the REMOTE_USER +environment variable does not have to be set by Apache. + +Alternatively, you can force a particular user name by getting Apache +to set REMOTE_USER, eg, to hardcode the user to www you could add +this to Apache's httpd.conf: # <--- change path as needed Setenv REMOTE_USER www @@ -1340,6 +1343,8 @@ images into $Conf{CgiImageDir} that BackupPC_Admin needs to serve up. You should make sure that $Conf{CgiImageDirURL} is the correct URL for the image directory. +See the section L for suggestions on debugging the Apache authentication setup. + =head2 How BackupPC Finds Hosts Starting with v2.0.0 the way hosts are discovered has changed. In most @@ -1425,6 +1430,46 @@ but does respond to a request directed to its IP address: =over 4 +=item Removing a client + +If there is a machine that no longer needs to be backed up (eg: a retired +machine) you have two choices. First, you can keep the backups accessible +and browsable, but disable all new backups. Alternatively, you can +completely remove the client and all its backups. + +To disable backups for a client there are two special values for +$Conf{FullPeriod} in that client's per-PC config.pl file: + +=over 4 + +=item -1 + +Don't do any regular backups on this machine. Manually +requested backups (via the CGI interface) will still occur. + +=item -2 + +Don't do any backups on this machine. Manually requested +backups (via the CGI interface) will be ignored. + +=back + +This will still allow that client's old backups to be browsable +and restorable. + +To completely remove a client and all its backups, you should remove its +entry in the conf/hosts file, and then delete the __TOPDIR__/pc/$host +directory. Whenever you change the hosts file, you should send +BackupPC a HUP (-1) signal so that it re-reads the hosts file. +If you don't do this, BackupPC will automatically re-read the +hosts file at the next regular wakeup. + +Note that when you remove a client's backups you won't initially recover +a lot of disk space. That's because the client's files are still in +the pool. Overnight, when BackupPC_nightly next runs, all the unused +pool files will be deleted and this will recover the disk space used +by the client's backups. + =item Copying the pool If the pool disk requirements grow you might need to copy the entire @@ -1630,11 +1675,69 @@ earlier section) so that user authentication works. Make sure the config settings $Conf{CgiAdminUserGroup} and $Conf{CgiAdminUsers} correctly specify the privileged administrator users. +=item You cannot access per-host information in the CGI interface + +If you get the error + + Only privileged users can view information about host xyz + +it means that BackupPC_Admin is unable to match the user's login +name (supplied by Apache via the REMOTE_USER environment variable) +with either that host's user name (in the conf/hosts file) or +with the administrators specified in the $Conf{CgiAdminUsers} +or $Conf{CgiAdminUserGroup} settings. + +The most common problem is that REMOTE_USER is not set because the +Apache authentication is not correctly configured. In this case +BackupPC_Admin will report this additional error: + + Note: $ENV{REMOTE_USER} is not set, which could mean there is an + installation problem. BackupPC_Admin expects Apache to authenticate + the user and pass their user name into this script as the REMOTE_USER + environment variable. See the documentation. + +You should review the configuration instructions to setup Apache +authentication correctly. To test if REMOTE_USER is being set +correctly, there is a simple script called printenv that is +included with Apache. This is a simple CGI script that prints +out all the environment variables. Place this script in the +same directory as BackupPC_Admin and run it with a URL like: + + http://myHost/cgi-bin/BackupPC/printenv + +Check the value of the REMOTE_USER environment variable. +Here's a copy of the printenv script: + + #!/usr/bin/perl + ## + ## printenv -- demo CGI program which just prints its environment + ## + + print "Content-type: text/plain\n\n"; + foreach $var (sort(keys(%ENV))) { + $val = $ENV{$var}; + $val =~ s|\n|\\n|g; + $val =~ s|"|\\"|g; + print "${var}=\"${val}\"\n"; + } + =item Can't ping or find host Please read the section L. -You should also verify that nmblookup correctly returns the netbios name. +The BackupPC_dump command now has a -v option, so the easiest way to +debug backup problems on a specific host is to run BackupPC_dump +manually as the BackupPC user: + + su __BACKUPPCUSER__ + __INSTALLDIR__/bin/BackupPC_dump -v -f hostName + +This will run a full dump on hostName (replace with your host name). +It will show each command (eg: ping, nmblookup and the full dump +commands) and the output from each command. Reading the output +carefully should show you what the problem is. + +You can also verify that nmblookup correctly returns the netbios name. This is essential for DHCP hosts, and depending upon the setting of $Conf{FixedIPNetBiosNameCheck} might also be required for fixed IP address hosts too. Run this command: @@ -1656,12 +1759,16 @@ The first name, converted to lower case, is used for the host name. =item Transport method doesn't work -The BackupPC_dump command now has a -v option, so the easiest way to +The BackupPC_dump command has a -v option, so the easiest way to debug backup problems on a specific host is to run BackupPC_dump manually as the BackupPC user: su __BACKUPPCUSER__ - __INSTALLDIR__/bin/BackupPC_zcat + __INSTALLDIR__/bin/BackupPC_dump -v -f hostName + +This will run a full dump on hostName (replace with your host name) +and will print all the output from each command, including the log +output. The most likely problems will relate to connecting to the smb shares on each host. On each failed backup, a file __TOPDIR__/pc/$host/XferLOG.bad.z diff --git a/lib/BackupPC/Attrib.pm b/lib/BackupPC/Attrib.pm index 886e643..dda3127 100644 --- a/lib/BackupPC/Attrib.pm +++ b/lib/BackupPC/Attrib.pm @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/FileZIO.pm b/lib/BackupPC/FileZIO.pm index e126b94..56987cd 100644 --- a/lib/BackupPC/FileZIO.pm +++ b/lib/BackupPC/FileZIO.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Lang/de.pm b/lib/BackupPC/Lang/de.pm index 55e6b6f..2d52bb0 100644 --- a/lib/BackupPC/Lang/de.pm +++ b/lib/BackupPC/Lang/de.pm @@ -1,4 +1,4 @@ -#!/usr/bin/perl -T +#!/bin/perl -T # # by Manfred Herrmann (V1.1) (some typo errors + 3 new strings) # CVS-> Revision ??? @@ -724,13 +724,6 @@ $Lang{Backup_requested_on_DHCP__host} = "Backup angefordert f $Lang{Backup_requested_on__host_by__User} = "Backup angefordert für \$host durch \$User"; $Lang{Backup_stopped_dequeued_on__host_by__User} = "Backup gestoppt/gelöscht für \$host durch \$User"; -$Lang{log_User__User_downloaded_tar_archive_for__host} = "LOG User \$User hat tar Archiv downgeloaded von \$host," - . " Backup \$num; folgende Dateien: " - . " \${join(\", \", \@fileListTrim)}"; - -$Lang{log_User__User_downloaded_zip_archive_for__host}= "LOG User \$User hat zip Archiv downgeloaded von \$host," - . " Backup \$num; folgende Dateien: " - . "\${join(\", \", \@fileListTrim)}"; $Lang{Restore_requested_to_host__hostDest__backup___num} = "Restore beauftragt nach Computer \$hostDest, von Backup #\$num," . " durch User \$User von Client \$ENV{REMOTE_ADDR}"; @@ -791,7 +784,7 @@ EOF # -------- $Lang{Last_error_is____EscHTML_StatusHost_error} = <Letzter Fehler ist \"\${EscHTML(\$StatusHost{error})}\" +
  • Letzter Fehler ist \"\${EscHTML(\$StatusHost{error})}\". EOF # ------ @@ -906,8 +899,10 @@ $Lang{Reason_backup_done} = "Backup durchgef $Lang{Reason_restore_done} = "Restore durchgeführt"; $Lang{Reason_nothing_to_do} = "kein Auftrag"; $Lang{Reason_backup_failed} = "Backup Fehler"; +$Lang{Reason_restore_failed} = "Restore Fehler"; $Lang{Reason_no_ping} = "nicht erreichbar"; $Lang{Reason_backup_canceled_by_user} = "Abbruch durch User"; +$Lang{Reason_restore_canceled_by_user} = "Abbruch durch User"; # --------- # Email messages diff --git a/lib/BackupPC/Lang/en.pm b/lib/BackupPC/Lang/en.pm index 5b26015..c10cec3 100644 --- a/lib/BackupPC/Lang/en.pm +++ b/lib/BackupPC/Lang/en.pm @@ -722,13 +722,6 @@ $Lang{Backup_requested_on_DHCP__host} = "Backup requested on DHCP \$host (\$In{h $Lang{Backup_requested_on__host_by__User} = "Backup requested on \$host by \$User"; $Lang{Backup_stopped_dequeued_on__host_by__User} = "Backup stopped/dequeued on \$host by \$User"; -$Lang{log_User__User_downloaded_tar_archive_for__host} = "log User \$User downloaded tar archive for \$host," - . " backup \$num; files were: " - . " \${join(\", \", \@fileListTrim)}"; - -$Lang{log_User__User_downloaded_zip_archive_for__host}= "log User \$User downloaded zip archive for \$host," - . " backup \$num; files were: " - . "\${join(\", \", \@fileListTrim)}"; $Lang{Restore_requested_to_host__hostDest__backup___num} = "Restore requested to host \$hostDest, backup #\$num," . " by \$User from \$ENV{REMOTE_ADDR}"; @@ -789,7 +782,7 @@ EOF # -------- $Lang{Last_error_is____EscHTML_StatusHost_error} = <Last error is \"\${EscHTML(\$StatusHost{error})}\" +
  • Last error is \"\${EscHTML(\$StatusHost{error})}\". EOF # ------ @@ -903,8 +896,10 @@ $Lang{Reason_backup_done} = "backup done"; $Lang{Reason_restore_done} = "restore done"; $Lang{Reason_nothing_to_do} = "nothing to do"; $Lang{Reason_backup_failed} = "backup failed"; +$Lang{Reason_restore_failed} = "restore failed"; $Lang{Reason_no_ping} = "no ping"; $Lang{Reason_backup_canceled_by_user} = "backup canceled by user"; +$Lang{Reason_restore_canceled_by_user} = "restore canceled by user"; # --------- # Email messages diff --git a/lib/BackupPC/Lang/es.pm b/lib/BackupPC/Lang/es.pm index 9902c55..c829e3c 100644 --- a/lib/BackupPC/Lang/es.pm +++ b/lib/BackupPC/Lang/es.pm @@ -724,13 +724,6 @@ $Lang{Backup_requested_on_DHCP__host} = "Copia de seguridad solicitada en DHCP \ $Lang{Backup_requested_on__host_by__User} = "Copia de seguridad solicitada en \$host por \$User"; $Lang{Backup_stopped_dequeued_on__host_by__User} = "Copia de seguridad detenida/desprogramada en \$host por \$User"; -$Lang{log_User__User_downloaded_tar_archive_for__host} = "El usuario del registro \$User ha descargado un archivo Tar para \$host," - . " copia de seguridad \$num; los archivos eran: " - . " \${join(\", \", \@fileListTrim)}"; - -$Lang{log_User__User_downloaded_zip_archive_for__host}= "El usuario del registro \$User ha descargado un archivo Zip para \$host," - . " copia de seguridad \$num; los archivos eran: " - . "\${join(\", \", \@fileListTrim)}"; $Lang{Restore_requested_to_host__hostDest__backup___num} = "Restauración solicitada para el host \$hostDest, copia de seguridad #\$num," . " por \$User desde \$ENV{REMOTE_ADDR}"; @@ -791,7 +784,7 @@ EOF # -------- $Lang{Last_error_is____EscHTML_StatusHost_error} = <El último error fué \"\${EscHTML(\$StatusHost{error})}\" +
  • El último error fué \"\${EscHTML(\$StatusHost{error})}\". EOF # ------ @@ -905,8 +898,10 @@ $Lang{Reason_backup_done} = "copia de seguridad realizada"; $Lang{Reason_restore_done} = "restauración realizada"; $Lang{Reason_nothing_to_do} = "nada por hacer"; $Lang{Reason_backup_failed} = "copia de seguridad fallida"; +$Lang{Reason_restore_failed} = "restauración fallida"; $Lang{Reason_no_ping} = "no hay ping"; $Lang{Reason_backup_canceled_by_user} = "copia cancelada por el usuario"; +$Lang{Reason_restore_canceled_by_user} = "restauración cancelada por el usuario"; # --------- # Email messages diff --git a/lib/BackupPC/Lang/fr.pm b/lib/BackupPC/Lang/fr.pm index d8521ca..13b80cb 100644 --- a/lib/BackupPC/Lang/fr.pm +++ b/lib/BackupPC/Lang/fr.pm @@ -729,14 +729,6 @@ $Lang{Backup_requested_on_DHCP__host} = "Demande de sauvegarde sur l\'h $Lang{Backup_requested_on__host_by__User} = "Sauvegarde demandée sur \$host par \$User"; $Lang{Backup_stopped_dequeued_on__host_by__User} = "Sauvegarde Arrêtée/déprogrammée pour \$host par \$User"; -$Lang{log_User__User_downloaded_tar_archive_for__host} = "log L\'utilisateur \$User a téléchargé " - . "l\'archive tar pour \$host," - . " sauvegarde \$num; Les fichiers étaient: " - . " \${join(\", \", \@fileListTrim)}"; -$Lang{log_User__User_downloaded_zip_archive_for__host}= "log L\'utilisateur \$User a téléchargé " - . "l\'archive zip pour \$host," - . " Sauvegarde \$num; Les fichiers étaient: " - . "\${join(\", \", \@fileListTrim)}"; $Lang{Restore_requested_to_host__hostDest__backup___num} = "Restauration demandée pour l\'hôte \$hostDest, " . "sauvegarde n° \$num," . " par \$User depuis \$ENV{REMOTE_ADDR}"; @@ -797,7 +789,7 @@ EOF # -------- $Lang{Last_error_is____EscHTML_StatusHost_error} = <La dernière erreur est \"\${EscHTML(\$StatusHost{error})}\" +
  • La dernière erreur est \"\${EscHTML(\$StatusHost{error})}\". EOF # ------ @@ -911,8 +903,10 @@ $Lang{Reason_backup_done} = "sauvegarde termin $Lang{Reason_restore_done} = "restauration terminée"; $Lang{Reason_nothing_to_do} = "rien à faire"; $Lang{Reason_backup_failed} = "la sauvegarde a échouée"; +$Lang{Reason_restore_failed} = "la restauration a échouée"; $Lang{Reason_no_ping} = "pas de ping"; $Lang{Reason_backup_canceled_by_user} = "sauvegarde annulée par l'utilisateur"; +$Lang{Reason_restore_canceled_by_user} = "restauration annulée par l'utilisateur"; # --------- # Email messages diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index ecc455d..43870b8 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -58,7 +58,7 @@ sub new TopDir => $topDir || '/data/BackupPC', BinDir => $installDir || '/usr/local/BackupPC', LibDir => $installDir || '/usr/local/BackupPC', - Version => '2.0.0beta2', + Version => '2.0.0beta3', BackupFields => [qw( num type startTime endTime nFiles size nFilesExist sizeExist nFilesNew sizeNew @@ -1004,7 +1004,7 @@ sub cmdVarSubstitute $arg =~ s{\$(\w+)(\+?)}{ exists($vars->{$1}) && ref($vars->{$1}) ne "ARRAY" ? ($2 eq "+" ? $bpc->shellEscape($vars->{$1}) : $vars->{$1}) - : "\$$1" + : "\$$1$2" }eg; # # Now replicate any array arguments; this just works for just one @@ -1048,7 +1048,7 @@ sub cmdExecOrEval print("cmdExecOrEval: about to exec ", $bpc->execCmd2ShellCmd(@$cmd), "\n") if ( $bpc->{verbose} ); - exec(@$cmd); + exec(map { m/(.*)/ } @$cmd); # untaint print(STDERR "Exec failed for @$cmd\n"); exit(1); } @@ -1102,7 +1102,7 @@ sub cmdSystemOrEval # close(STDERR); open(STDERR, ">&STDOUT"); - exec(@$cmd); + exec(map { m/(.*)/ } @$cmd); # untaint print("Exec of @$cmd failed\n"); exit(1); } diff --git a/lib/BackupPC/PoolWrite.pm b/lib/BackupPC/PoolWrite.pm index f05223c..d032d3f 100644 --- a/lib/BackupPC/PoolWrite.pm +++ b/lib/BackupPC/PoolWrite.pm @@ -56,7 +56,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/View.pm b/lib/BackupPC/View.pm index 0572bfe..d3ad18f 100644 --- a/lib/BackupPC/View.pm +++ b/lib/BackupPC/View.pm @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Rsync.pm b/lib/BackupPC/Xfer/Rsync.pm index 8b8cf55..f0350c9 100644 --- a/lib/BackupPC/Xfer/Rsync.pm +++ b/lib/BackupPC/Xfer/Rsync.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/RsyncFileIO.pm b/lib/BackupPC/Xfer/RsyncFileIO.pm index cd0dc82..d40d51f 100644 --- a/lib/BackupPC/Xfer/RsyncFileIO.pm +++ b/lib/BackupPC/Xfer/RsyncFileIO.pm @@ -12,7 +12,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # @@ -968,26 +968,29 @@ sub fileListEltSend || $type == BPC_FTYPE_BLOCKDEV || $type == BPC_FTYPE_SYMLINK ) { my $fh = BackupPC::FileZIO->open($a->{fullPath}, 0, $a->{compress}); - my $str; + my($str, $rdSize); if ( defined($fh) ) { - if ( $fh->read(\$str, $a->{size} + 1) == $a->{size} ) { - if ( $type == BPC_FTYPE_SYMLINK ) { - # - # Reconstruct symbolic link - # - $extraAttribs = { link => $str }; - } elsif ( $str =~ /(\d*),(\d*)/ ) { - # - # Reconstruct char or block special major/minor device num - # - $extraAttribs = { rdev => $1 * 256 + $2 }; - } else { - $fio->log("$name: unexpected special file contents $str"); + $rdSize = $fh->read(\$str, $a->{size} + 1024); + if ( $type == BPC_FTYPE_SYMLINK ) { + # + # Reconstruct symbolic link + # + $extraAttribs = { link => $str }; + if ( $rdSize != $a->{size} ) { + # ERROR + $fio->log("$name: can't read exactly $a->{size} bytes"); $fio->{stats}{errorCnt}++; } + } elsif ( $str =~ /(\d*),(\d*)/ ) { + # + # Reconstruct char or block special major/minor device num + # + # Note: char/block devices have $a->{size} = 0, so we + # can't do an error check on $rdSize. + # + $extraAttribs = { rdev => $1 * 256 + $2 }; } else { - # ERROR - $fio->log("$name: can't read exactly $a->{size} bytes"); + $fio->log("$name: unexpected special file contents $str"); $fio->{stats}{errorCnt}++; } $fh->close; diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index 333f72c..b694785 100644 --- a/lib/BackupPC/Xfer/Smb.pm +++ b/lib/BackupPC/Xfer/Smb.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index 5358943..c4f9c6a 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Zip/FileMember.pm b/lib/BackupPC/Zip/FileMember.pm index a6a5bd8..5e41c58 100644 --- a/lib/BackupPC/Zip/FileMember.pm +++ b/lib/BackupPC/Zip/FileMember.pm @@ -33,7 +33,7 @@ # #======================================================================== # -# Version 2.0.0beta2, released 13 Apr 2003. +# Version 2.0.0beta3, released 1 Jun 2003. # # See http://backuppc.sourceforge.net. # diff --git a/makeDist b/makeDist index e3ba30f..231ed1b 100755 --- a/makeDist +++ b/makeDist @@ -41,8 +41,8 @@ use File::Copy; umask(0022); -my $Version = "2.0.0beta2"; -my $ReleaseDate = "11 May 2003"; +my $Version = "2.0.0beta3"; +my $ReleaseDate = "1 Jun 2003"; my $DistDir = "dist/BackupPC-$Version"; my @PerlSrc = qw( -- 2.20.1