From: cbarratt Date: Mon, 10 Feb 2003 07:40:23 +0000 (+0000) Subject: - allow PingCmd and Nmb commands to be empty strings, allowing these X-Git-Tag: v2_0_0beta0~4 X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=commitdiff_plain;h=9175f9157f0d54b50ebf11d2036c20f50ffc6d9d;ds=sidebyside - allow PingCmd and Nmb commands to be empty strings, allowing these steps to be skipped. - a few fixes to rsync. - fixed top-level broswe navigation bug in cgi script. --- diff --git a/bin/BackupPC b/bin/BackupPC index e13b60d..d61aa56 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -249,8 +249,8 @@ sub Main_Initialize exit(1); } foreach my $progName ( qw(SmbClientPath NmbLookupPath PingPath DfPath - SendmailPath) ) { - next if ( !defined($Conf{$progName}) || -x $Conf{$progName} ); + SendmailPath SshPath) ) { + next if ( $Conf{$progName} eq "" || -x $Conf{$progName} ); print(STDERR $bpc->timeStamp, "\$Conf{$progName} = '$Conf{$progName}' is not a" . " valid executable program\n"); diff --git a/bin/BackupPC_compressPool b/bin/BackupPC_compressPool index 07f8661..397c64d 100755 --- a/bin/BackupPC_compressPool +++ b/bin/BackupPC_compressPool @@ -49,7 +49,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index bc09e4e..1bb28c1 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -68,7 +68,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -119,7 +119,8 @@ if ( $opts{d} ) { # host name via NetBios using nmblookup. # $hostIP = $client; - exit(1) if ( $bpc->CheckHostAlive($hostIP) < 0 ); + exit(1) if ( $bpc->CheckHostAlive($hostIP) < 0 + || $Conf{NmbLookupCmd} eq "" ); ($client, $user) = $bpc->NetBiosInfoGet($hostIP); exit(1) if ( $host !~ /^([\w\.\s-]+)$/ ); my $hosts = $bpc->HostInfoRead($client); @@ -147,6 +148,8 @@ if ( defined(my $error = $bpc->ConfigRead($client)) ) { $SIG{INT} = \&catch_signal; $SIG{ALRM} = \&catch_signal; $SIG{TERM} = \&catch_signal; +$SIG{PIPE} = \&catch_signal; +my $Pid = $$; # # Make sure we eventually timeout if there is no activity from @@ -771,7 +774,13 @@ sub catch_signal my $signame = shift; my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : ""; + # + # Ignore signals in children + # + return if ( $Pid != $$ ); + print(LOG $bpc->timeStamp, "cleaning up after signal $signame\n"); + $SIG{$signame} = 'IGNORE'; UserCommandRun("DumpPostUserCmd") if ( $NeedPostCmd ); $XferLOG->write(\"exiting after signal $signame\n"); $XferLOG->close(); @@ -890,10 +899,11 @@ sub BackupExpire sub CorrectHostCheck { my($hostIP, $host) = @_; - return if ( $hostIP eq $host && !$Conf{FixedIPNetBiosNameCheck} ); + return if ( $hostIP eq $host && !$Conf{FixedIPNetBiosNameCheck} + || $Conf{NmbLookupCmd} eq "" ); my($netBiosHost, $netBiosUser) = $bpc->NetBiosInfoGet($hostIP); return "host $host has mismatching netbios name $netBiosHost" - if ( $netBiosHost ne $host ); + if ( $netBiosHost ne $host ); return; } diff --git a/bin/BackupPC_link b/bin/BackupPC_link index fa014e7..147383c 100755 --- a/bin/BackupPC_link +++ b/bin/BackupPC_link @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_nightly b/bin/BackupPC_nightly index 82f1351..43ba98c 100755 --- a/bin/BackupPC_nightly +++ b/bin/BackupPC_nightly @@ -35,7 +35,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index 18e5700..27d4c94 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -417,7 +417,8 @@ exit(RestoreCleanup($client)); sub CorrectHostCheck { my($hostIP, $host) = @_; - return if ( $hostIP eq $host && !$Conf{FixedIPNetBiosNameCheck} ); + return if ( $hostIP eq $host && !$Conf{FixedIPNetBiosNameCheck} + || $Conf{NmbLookupCmd} eq "" ); my($netBiosHost, $netBiosUser) = $bpc->NetBiosInfoGet($hostIP); return "host $host has mismatching netbios name $netBiosHost" if ( $netBiosHost ne $host ); diff --git a/bin/BackupPC_sendEmail b/bin/BackupPC_sendEmail index 4ba2778..d5d4e00 100755 --- a/bin/BackupPC_sendEmail +++ b/bin/BackupPC_sendEmail @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_serverMesg b/bin/BackupPC_serverMesg index fb444d3..f80e6d7 100755 --- a/bin/BackupPC_serverMesg +++ b/bin/BackupPC_serverMesg @@ -43,7 +43,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarCreate b/bin/BackupPC_tarCreate index 2fb6459..7327a7a 100755 --- a/bin/BackupPC_tarCreate +++ b/bin/BackupPC_tarCreate @@ -48,7 +48,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_tarExtract b/bin/BackupPC_tarExtract index fc5dfa5..db5ec22 100755 --- a/bin/BackupPC_tarExtract +++ b/bin/BackupPC_tarExtract @@ -27,7 +27,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_trashClean b/bin/BackupPC_trashClean index cabeffb..1c78b1c 100755 --- a/bin/BackupPC_trashClean +++ b/bin/BackupPC_trashClean @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zcat b/bin/BackupPC_zcat index b7bd7e1..f1032c4 100755 --- a/bin/BackupPC_zcat +++ b/bin/BackupPC_zcat @@ -32,7 +32,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/bin/BackupPC_zipCreate b/bin/BackupPC_zipCreate index ac0c237..36a1e30 100755 --- a/bin/BackupPC_zipCreate +++ b/bin/BackupPC_zipCreate @@ -51,7 +51,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/cgi-bin/BackupPC_Admin b/cgi-bin/BackupPC_Admin index 7e0209c..76e35b7 100755 --- a/cgi-bin/BackupPC_Admin +++ b/cgi-bin/BackupPC_Admin @@ -39,7 +39,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -601,10 +601,14 @@ sub Action_Browse # Loop over each of the files in this directory # foreach my $f ( sort(keys(%$attr)) ) { - my($dirOpen, $gotDir, $imgStr, $img); + my($dirOpen, $gotDir, $imgStr, $img, $path); my $fURI = $f; # URI escaped $f my $shareURI = $share; # URI escaped $share - (my $path = "$relDir/$f") =~ s{//+}{/}g; + if ( $relDir eq "" ) { + $path = $f; + } else { + ($path = "$relDir/$f") =~ s{//+}{/}g; + } if ( $shareURI eq "" ) { $shareURI = $path; $path = "/"; diff --git a/conf/config.pl b/conf/config.pl index 679908e..0f73ec6 100644 --- a/conf/config.pl +++ b/conf/config.pl @@ -226,6 +226,17 @@ $Conf{InstallDir} = ''; # $Conf{BackupPCUserVerify} = 1; +# +# Maximum number of hardlinks supported by the $TopDir file system +# that BackupPC uses. Most linux or unix file systems should support +# at least 32000 hardlinks per file, or 64K in other cases. If a pool +# file already has this number of hardlinks, a new pool file is created +# so that new hardlinks can be accommodated. This limit will only +# be hit if an identical file appears at least this number of times +# across all the backups. +# +$Conf{HardLinkMax} = 31999; + ########################################################################### # What to backup and when to do it # (can be overridden in the per-PC config.pl) diff --git a/doc-src/BackupPC.pod b/doc-src/BackupPC.pod index 59af087..c87b31e 100644 --- a/doc-src/BackupPC.pod +++ b/doc-src/BackupPC.pod @@ -151,13 +151,6 @@ on increasingly better RAID systems. At other sites a secondary tape backup will be required. This tape backup can be done perhaps weekly from the BackupPC pool file system. -One comment: in the US in particular, permanent backups of things like -email are becoming strongly discouraged by lawyers because of discovery -prior to possible litigation. Using BackupPC without tape backup allows -recent file changes or losses to be restored, but without keeping a -history more than a month or two old (although this doesn't avoid the -problem of old emails languishing in user's email folders forever). - =back =head2 Resources @@ -184,20 +177,25 @@ This page has links to the current releases of BackupPC. =item Mail lists -Two BackupPC mailing lists exist for announcements (backuppc-announce) -and reporting information, asking questions, discussing development or -any other topic relevant to BackupPC (backuppc-users). +Three BackupPC mailing lists exist for announcements (backuppc-announce), +developers (backuppc-devel), and a general user list for support, asking +questions or any other topic relevant to BackupPC (backuppc-users). -You are encouraged to subscribe to either the backuppc-announce -or backuppc-users mail list on sourceforge.net at either: +You can subscribe to these lists by visiting: http://lists.sourceforge.net/lists/listinfo/backuppc-announce http://lists.sourceforge.net/lists/listinfo/backuppc-users + http://lists.sourceforge.net/lists/listinfo/backuppc-devel The backuppc-announce list is moderated and is used only for important announcements (eg: new versions). It is low traffic. -You only need to subscribe to one list: backuppc-users also -receives any messages on backuppc-announce. +You only need to subscribe to one of backuppc-announce and +backuppc-users: backuppc-users also receives any messages on +backuppc-announce. + +The backuppc-devel list is only for developers who are working on BackupPC. +Do not post questions or support requests there. But detailed technical +discussions should happen on this list. To post a message to the backuppc-users list, send an email to @@ -208,7 +206,7 @@ Do not send subscription requests to this address! =item Other Programs of Interest If you want to mirror linux or unix files or directories to a remote server -you should consider rsync, L. BackupPC uses +you should consider rsync, L. BackupPC now uses rsync as a transport mechanism; if you are already an rsync user you can think of BackupPC as adding efficient storage (compression and pooling) and a convenient user interface to rsync. @@ -216,13 +214,23 @@ pooling) and a convenient user interface to rsync. Unison is a utility that can do two-way, interactive, synchronization. See L. -Two popular open source packages that do tape backup are -Amanda (L) and -afbackup (L). +Three popular open source packages that do tape backup are +Amanda (L), +afbackup (L), and +Bacula (L). Amanda can also backup WinXX machines to tape using samba. These packages can be used as back ends to BackupPC to backup the BackupPC server data to tape. +Various programs and scripts use rsync to provide hardlinked backups. +See, for example, Mike Rubel's site (L), +J. W. Schultz's dirvish (L), +and John Bowman's rlbackup (L). +BackupPC provides many additional features, such as compressed storage, +hardlinking any matching files (rather than just files with the same name), +and storing special files without root priviliges. But these other scripts +provide simple and effective solutions and are worthy of consideration. + =back =head2 Road map diff --git a/lib/BackupPC/Attrib.pm b/lib/BackupPC/Attrib.pm index 98b0390..7591774 100644 --- a/lib/BackupPC/Attrib.pm +++ b/lib/BackupPC/Attrib.pm @@ -30,7 +30,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/FileZIO.pm b/lib/BackupPC/FileZIO.pm index 637a39d..7022896 100644 --- a/lib/BackupPC/FileZIO.pm +++ b/lib/BackupPC/FileZIO.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Lib.pm b/lib/BackupPC/Lib.pm index e061eee..1eb848e 100644 --- a/lib/BackupPC/Lib.pm +++ b/lib/BackupPC/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -126,6 +126,13 @@ sub trashJob return " trashClean "; } +sub ConfValue +{ + my($bpc, $param) = @_; + + return $bpc->{Conf}{$param}; +} + sub timeStamp { my($bpc, $t, $noPad) = @_; @@ -693,6 +700,11 @@ sub CheckHostAlive my($bpc, $host) = @_; my($s, $pingCmd); + # + # Return success if the ping cmd is undefined or empty. + # + return 0 if ( $bpc->{Conf}{PingCmd} eq "" ); + my $args = { pingPath => $bpc->{Conf}{PingPath}, host => $host, @@ -721,6 +733,7 @@ sub CheckFileSystemUsage my($topDir) = $bpc->{TopDir}; my($s, $dfCmd); + return 0 if ( $bpc->{Conf}{DfCmd} eq "" ); my $args = { dfPath => $bpc->{Conf}{DfPath}, topDir => $bpc->{TopDir}, @@ -741,6 +754,11 @@ sub NetBiosInfoGet my($netBiosHostName, $netBiosUserName); my($s, $nmbCmd); + # + # Skip NetBios check if NmbLookupCmd is emtpy + # + return ($host, undef) if ( $bpc->{Conf}{NmbLookupCmd} eq "" ); + my $args = { nmbLookupPath => $bpc->{Conf}{NmbLookupPath}, host => $host, @@ -764,6 +782,11 @@ sub NetBiosHostIPFind my($netBiosHostName, $netBiosUserName); my($s, $nmbCmd); + # + # Skip NetBios lookup if NmbLookupFindHostCmd is emtpy + # + return $host if ( $bpc->{Conf}{NmbLookupFindHostCmd} eq "" ); + my $args = { nmbLookupPath => $bpc->{Conf}{NmbLookupPath}, host => $host, @@ -936,10 +959,14 @@ sub cmdExecOrEval if ( (ref($cmd) eq "ARRAY" ? $cmd->[0] : $cmd) =~ /^\&/ ) { $cmd = join(" ", $cmd) if ( ref($cmd) eq "ARRAY" ); - eval($cmd) + eval($cmd); + print(STDERR "Perl code fragment for exec shouldn't return!!\n"); + exit(1); } else { $cmd = [split(/\s+/, $cmd)] if ( ref($cmd) ne "ARRAY" ); exec(@$cmd); + print(STDERR "Exec failed for @$cmd\n"); + exit(1); } } diff --git a/lib/BackupPC/PoolWrite.pm b/lib/BackupPC/PoolWrite.pm index 7957f2c..fde4f5d 100644 --- a/lib/BackupPC/PoolWrite.pm +++ b/lib/BackupPC/PoolWrite.pm @@ -56,7 +56,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -89,6 +89,8 @@ sub new eof => undef, }, $class; + $self->{hardLinkMax} = $bpc->ConfValue("HardLinkMax"); + # # Always unlink any current file in case it is already linked # @@ -122,7 +124,8 @@ sub write my $fileName = $a->{fileCnt} < 0 ? $a->{base} : "$a->{base}_$a->{fileCnt}"; last if ( !-f $fileName ); - if ( !defined($fh = BackupPC::FileZIO->open($fileName, 0, + if ( (stat(_))[3] >= $a->{hardLinkMax} + || !defined($fh = BackupPC::FileZIO->open($fileName, 0, $a->{compress})) ) { $a->{fileCnt}++; next; @@ -176,7 +179,8 @@ sub write # while ( -f $fileName ) { my $fh; - if ( !defined($fh = BackupPC::FileZIO->open($fileName, 0, + if ( (stat(_))[3] >= $a->{hardLinkMax} + || !defined($fh = BackupPC::FileZIO->open($fileName, 0, $a->{compress})) ) { $a->{fileCnt}++; #print(" Discarding $fileName (open failed)\n"); @@ -273,12 +277,16 @@ sub write push(@{$a->{errors}}, "Botch, no matches on $a->{fileName}" . " ($a->{digest})\n"); } elsif ( @{$a->{files}} > 1 ) { - my $str = "Unexpected multiple matches on" - . " $a->{fileName} ($a->{digest})\n"; - for ( my $i = 0 ; $i < @{$a->{files}} ; $i++ ) { - $str .= " -> $a->{files}[$i]->{name}\n"; - } - push(@{$a->{errors}}, $str); + # + # This is no longer a real error because $Conf{HardLinkMax} + # could be hit, thereby creating identical pool files + # + #my $str = "Unexpected multiple matches on" + # . " $a->{fileName} ($a->{digest})\n"; + #for ( my $i = 0 ; $i < @{$a->{files}} ; $i++ ) { + # $str .= " -> $a->{files}[$i]->{name}\n"; + #} + #push(@{$a->{errors}}, $str); } #print(" Linking $a->{fileName} to $a->{files}[0]->{name}\n"); if ( @{$a->{files}} && !link($a->{files}[0]->{name}, $a->{fileName}) ) { diff --git a/lib/BackupPC/View.pm b/lib/BackupPC/View.pm index ae95d33..a7ec145 100644 --- a/lib/BackupPC/View.pm +++ b/lib/BackupPC/View.pm @@ -31,7 +31,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Rsync.pm b/lib/BackupPC/Xfer/Rsync.pm index cf20d64..c1dd22b 100644 --- a/lib/BackupPC/Xfer/Rsync.pm +++ b/lib/BackupPC/Xfer/Rsync.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -268,6 +268,7 @@ sub start }, rsyncCmdType => "full", rsyncArgs => $rsyncArgs, + timeout => $conf->{ClientTimeout}, logHandler => sub { my($str) = @_; $str .= "\n"; @@ -279,7 +280,6 @@ sub start conf => $t->{conf}, backups => $t->{backups}, logLevel => $conf->{RsyncLogLevel}, - timeout => $conf->{ClientTimeout}, logHandler => sub { my($str) = @_; $str .= "\n"; diff --git a/lib/BackupPC/Xfer/RsyncFileIO.pm b/lib/BackupPC/Xfer/RsyncFileIO.pm index 44a61ad..10ee772 100644 --- a/lib/BackupPC/Xfer/RsyncFileIO.pm +++ b/lib/BackupPC/Xfer/RsyncFileIO.pm @@ -12,7 +12,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # @@ -121,7 +121,6 @@ sub csumStart } else { delete($fio->{csumDigest}); } - alarm($fio->{timeout}) if ( defined($fio->{timeout}) ); } sub csumGet @@ -179,7 +178,6 @@ sub readStart return; } $fio->log("$f->{name}: opened for read") if ( $fio->{logLevel} >= 4 ); - alarm($fio->{timeout}) if ( defined($fio->{timeout}) ); } sub read @@ -434,7 +432,7 @@ sub attribWrite my $poolWrite = BackupPC::PoolWrite->new($fio->{bpc}, $fileName, length($data), $fio->{xfer}{compress}); $poolWrite->write(\$data); - $fio->processClose($poolWrite, $fio->{attrib}{$d}->fileName($d), + $fio->processClose($poolWrite, $fio->{attrib}{$d}->fileName($dirM), length($data), 0); } delete($fio->{attrib}{$d}); @@ -623,7 +621,8 @@ sub fileDeltaRxStart $fio->{rxRemainder} = $remainder; # size of the last block $fio->{rxMatchBlk} = 0; # current start of match $fio->{rxMatchNext} = 0; # current next block of match - my $rxSize = ($cnt - 1) * $size + $remainder; + $fio->{rxSize} = 0; # size of received file + my $rxSize = $cnt > 0 ? ($cnt - 1) * $size + $remainder : 0; if ( $fio->{rxFile}{size} != $rxSize ) { $fio->{rxMatchBlk} = undef; # size different, so no file match $fio->log("$fio->{rxFile}{name}: size doesn't match" @@ -634,7 +633,6 @@ sub fileDeltaRxStart delete($fio->{rxOutFd}); delete($fio->{rxDigest}); delete($fio->{rxInData}); - alarm($fio->{timeout}) if ( defined($fio->{timeout}) ); } # @@ -723,7 +721,7 @@ sub fileDeltaRxNext # unlink("$fio->{outDirSh}RStmp") if ( -f "$fio->{outDirSh}RStmp" ); - if ( open(F, ">+", "$fio->{outDirSh}RStmp") ) { + if ( open(F, "+>", "$fio->{outDirSh}RStmp") ) { my $data; while ( $fh->read(\$data, 1024 * 1024) > 0 ) { if ( syswrite(F, $data) != length($data) ) { @@ -784,6 +782,7 @@ sub fileDeltaRxNext } $fio->{rxOutFd}->write(\$data); $fio->{rxDigest}->add($data); + $fio->{rxSize} += length($data); } $fio->{rxMatchBlk} = undef; } @@ -803,6 +802,7 @@ sub fileDeltaRxNext if ( $fio->{logLevel} >= 10 ); $fio->{rxOutFd}->write(\$newData); $fio->{rxDigest}->add($newData); + $fio->{rxSize} += length($newData); } } @@ -830,6 +830,7 @@ sub fileDeltaRxDone my $data; while ( $fh->read(\$data, 4 * 65536) > 0 ) { $fio->{rxDigest}->add($data); + $fio->{rxSize} += length($data); } $fh->close; } else { @@ -859,12 +860,12 @@ sub fileDeltaRxDone # One special case is an empty file: if the file size is # zero we need to open the output file to create it. # - if ( $fio->{rxFile}{size} == 0 ) { + if ( $fio->{rxSize} == 0 ) { my $rxOutFileRel = "$fio->{shareM}/" . $fio->{bpc}->fileNameMangle($name); my $rxOutFile = $fio->{outDir} . $rxOutFileRel; $fio->{rxOutFd} = BackupPC::PoolWrite->new($fio->{bpc}, - $rxOutFile, $fio->{rxFile}{size}, + $rxOutFile, $fio->{rxSize}, $fio->{xfer}{compress}); } if ( !defined($fio->{rxOutFd}) ) { @@ -897,19 +898,22 @@ sub fileDeltaRxDone # Cumulate the stats # $fio->{stats}{TotalFileCnt}++; - $fio->{stats}{TotalFileSize} += $fio->{rxFile}{size}; + $fio->{stats}{TotalFileSize} += $fio->{rxSize}; $fio->{stats}{ExistFileCnt}++; - $fio->{stats}{ExistFileSize} += $fio->{rxFile}{size}; + $fio->{stats}{ExistFileSize} += $fio->{rxSize}; $fio->{stats}{ExistFileCompSize} += -s $rxOutFile; - return; + $fio->{rxFile}{size} = $fio->{rxSize}; + return $fio->attribSet($fio->{rxFile}); } } if ( defined($fio->{rxOutFd}) ) { my $exist = $fio->processClose($fio->{rxOutFd}, $fio->{rxOutFileRel}, - $fio->{rxFile}{size}, 1); + $fio->{rxSize}, 1); $fio->logFileAction($exist ? "pool" : "create", $fio->{rxFile}) if ( $fio->{logLevel} >= 1 ); + $fio->{rxFile}{size} = $fio->{rxSize}; + return $fio->attribSet($fio->{rxFile}); } delete($fio->{rxDigest}); delete($fio->{rxInData}); @@ -984,7 +988,6 @@ sub fileListEltSend $fio->{stats}{TotalFileCnt}++; $fio->{stats}{TotalFileSize} += $a->{size}; } - alarm($fio->{timeout}) if ( defined($fio->{timeout}) ); } sub fileListSend @@ -1013,7 +1016,6 @@ sub finish # Flush the attributes if this is the child # $fio->attribWrite(undef); - alarm($fio->{timeout}) if ( defined($fio->{timeout}) ); } #sub is_tainted diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index d3b688b..8fdbfea 100644 --- a/lib/BackupPC/Xfer/Smb.pm +++ b/lib/BackupPC/Xfer/Smb.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index 4637828..872338c 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. # diff --git a/lib/BackupPC/Zip/FileMember.pm b/lib/BackupPC/Zip/FileMember.pm index c39589a..3c8fc6a 100644 --- a/lib/BackupPC/Zip/FileMember.pm +++ b/lib/BackupPC/Zip/FileMember.pm @@ -33,7 +33,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 18 Jan 2003. +# Version 2.0.0_CVS, released 3 Feb 2003. # # See http://backuppc.sourceforge.net. #