scanner bails out on dir not found on FTP server #139

Closed
poeml opened this Issue Jun 5, 2015 · 0 comments

Projects

None yet

1 participant

@poeml
Owner
poeml commented Jun 5, 2015
                                                                                      [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue139

Title    scanner bails out on dir not found on FTP server
 Priority   bug       Status      resolved
Superseder           Nosy List    dagobert, poeml
Assigned To          Keywords     scanner

msg502 (view) Author: dagobert Date: 2014-02-01.14:05:44

The scanner.pl bails out if a directory is not found on an FTP sever during scanning:

Net::FTP=GLOB(0x77e8a8)<<< 230 Anonymous access granted, restrictions apply
Net::FTP=GLOB(0x77e8a8)>>> TYPE I
Net::FTP=GLOB(0x77e8a8)<<< 200 Type set to I
belnet: connected to ftp.belnet.be, (anonymous,/opt/csw/bin/scanner@mirror-
test.opencsw.org)
Net::FTP=GLOB(0x77e8a8)>>> CWD /mirrorsx/opencsw/
Net::FTP=GLOB(0x77e8a8)<<< 550 /mirrorsx/opencsw/: No such file or directory
$VAR1 = '550 failed: ftp-cwd(/mirrorsx/opencsw/): ';
DIE: (=> => /opt/csw/bin/scanner 317 main::ftp_readdir)
Can't use string ("550 failed: ftp-cwd(/mirrorsx/op") as an ARRAY ref while "strict
refs" in use at /opt/csw/bin/scanner line 804.
Completed in 1 seconds

This is due to the regex match of a scalar string made against a ref to a string, this
should be just a regex match against the scaler. This patch fixes the issue:

From 5ca8b992d77a3479f1081432d21f8a96382b41c6 Mon Sep 17 00:00:00 2001
From: Dagobert Michelsen dam@opencsw.org
Date: Sat, 1 Feb 2014 14:56:06 +0100
Subject: [PATCH] Do not take ref on a simple scalar string or it wont match


tools/scanner.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/scanner.pl b/tools/scanner.pl
index ab9bcb8..4216721 100755
--- a/tools/scanner.pl
+++ b/tools/scanner.pl
@@ -774,7 +774,7 @@ sub ftp_readdir
return unless defined $ftp;
my $text = ftp_cont($ftp, "$url/$name");

  • if(!ref($text) && $text =~ m/^(\d\d\d)\s/) { # some FTP status code? Not
    good.

  • if(!ref($text) && $text =~ m/^(\d\d\d)\s/) { # some FTP status code? Not good.

    Bug: Net::FTP wrongly reports timeouts (421) as code 550:

    sunsite.informatik.rwth-aachen.de: ftp dir: ftp://sunsite.informatik.rwth-

aachen.de/pub/linux/

opensuse/distribution/11.0/repo/debug/suse/i686

1.8.4.1

msg512 (view) Author: poeml Date: 2014-02-02.12:34:49

fixed in r8358. Thanks!

History
         Date           User   Action            Args
                                      status: unread -> resolved
2014-02-02 12:34:49 poeml    set    nosy: + poeml
                                      messages: + msg512
2014-02-01 14:05:44 dagobert create

(end of migrated issue)
@poeml poeml added bug resolved labels Jun 5, 2015
@poeml poeml closed this Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment