On Mon, Aug 24, 2009 at 4:24 AM, Mirco Piccin<[email protected]> wrote:
> Hi all,
> any news about FTP Xfer method?
>

Hello Mirco,

In addition to the $args->{Host}, $t->{host} ambiguity, the ftp module
is trying to print out OS errors instead of eval errors, which is
causing misleading errors.  Please patch your install directory with
the attached patch (use the option -p1 as well).  Please tell me if
this patch yields more information.

Adios,

-- 
Paul Mantz
http://www.mcpantz.org
BackupPC - Network Backup with De-Duplication http://www.backuppc.com
Zmanda - Open source backup and recovery http://www.zmanda.com/
From d8fb191dd5526a895b681416080d66615f1a6228 Mon Sep 17 00:00:00 2001
From: Paul C Mantz <[email protected]>
Date: Thu, 27 Aug 2009 23:47:42 -0500
Subject: [PATCH] eval errors handled correctly in BackupPC::Xfer::Ftp

---
 lib/BackupPC/Xfer/Ftp.pm |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/lib/BackupPC/Xfer/Ftp.pm b/lib/BackupPC/Xfer/Ftp.pm
index 91f1881..d009eb7 100644
--- a/lib/BackupPC/Xfer/Ftp.pm
+++ b/lib/BackupPC/Xfer/Ftp.pm
@@ -187,7 +187,7 @@ sub start
                                 : Net::FTP->new(%$args);
     };
     if ($@) {
-        $t->{_errStr} = "Can't open connection to $args->{host}: $!";
+        $t->{_errStr} = "Can't open connection to $args->{Host}: $@";
         $t->{xferErrCnt}++;
         return;
     }
@@ -197,8 +197,8 @@ sub start
     #
     undef $@;
     eval { $t->{ftp}->login( $conf->{FtpUserName}, $conf->{FtpPasswd} ); };
-    if ( $@ ) {
-        $t->{_errStr} = "Can't login to $args->{host}: $!";
+    if ($@) {
+        $t->{_errStr} = "Can't login to $args->{Host}: $@";
         $t->{xferErrCnt}++;
         return;
     }
@@ -207,7 +207,7 @@ sub start
     eval { $t->{ftp}->binary(); };
     if ($@) {
         $t->{_errStr} =
-          "Can't enable binary transfer mode to $args->{host}: $!";
+          "Can't enable binary transfer mode to $args->{Host}: $@";
         $t->{xferErrCnt}++;
         return;
     }
@@ -215,8 +215,7 @@ sub start
     undef $@;
     eval { $t->{shareName} =~ m/^\.?$/ || $t->{ftp}->cwd( $t->{shareName} ); };
     if ($@) {
-        $t->{_errStr} =
-            "Can't change working directory to $t->{shareName}: $!";
+        $t->{_errStr} = "Can't change working directory to $t->{shareName}: $@";
         $t->{xferErrCnt}++;
         return;
     }
@@ -225,7 +224,7 @@ sub start
     eval { $t->{sharePath} = $t->{ftp}->pwd(); };
     if ($@) {
         $t->{_errStr} =
-            "Can't retrieve full working directory of $t->{shareName}: $!";
+          "Can't retrieve full working directory of $t->{shareName}: $@";
         $t->{xferErrCnt}++;
         return;
     }
@@ -575,7 +574,7 @@ sub remotels
     };
     if ($@) {
         $t->{xferErrCnt}++;
-        return "can't retrieve remote directory contents of $path: $!";
+        return "can't retrieve remote directory contents of $path: $@";
     }
 
     foreach my $info ( @{parse_dir($dirContents)} ) {
@@ -750,13 +749,11 @@ sub handleDir
 
     unless ( -d $OutDir ) {
 
+        undef $@;
         eval { mkpath( $OutDir, 0, 0755 ) };
-        if ( $@ ) {
-            $t->logFileAction( "fail", $dir->{utf8name}, $dir );
-            return;
-        } else {
-            $t->logFileAction( "create", $dir->{utf8name}, $dir );
-        }
+        $t->logFileAction( defined $@ ? "fail" : "create",
+            $dir->{utf8name}, $dir );
+        return if defined $@;
     }
 
     $attrib    = BackupPC::Attrib->new( { compress => $t->{compress} } );
-- 
1.6.0.4

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
BackupPC-users mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to