Skip Menu |

This queue is for tickets about the Net-FTP-File CPAN distribution.

Report information
The Basics
Id: 62393
Status: new
Priority: 0/
Queue: Net-FTP-File

People
Owner: Nobody in particular
Requestors: farhad_saberi [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: definitely a tiny bug with Net ftp file
Date: Fri, 22 Oct 2010 21:19:29 -0700 (PDT)
To: bug-Net-FTP-File [...] rt.cpan.org
From: Farhad Saberi <farhad_saberi [...] yahoo.com>
hello Using version 0.6. Great module, i've been using it a lot. But here is a bug i found. It is at line 50 inside "our %DirProcHash", where this substr call happens: $path = substr( $path, 1 ); # remove first space that is there but is not part of the name The parsing becomes bad if all of the directory names are 1 character long only. I created this directory structure: Show quoted text
ftp> pwd
257 "/tt/1/2" is your current location Show quoted text
ftp> ls
200 PORT command successful 150 Connecting to port 52569 drwxr-xr-x 4 9754 33345 4096 Oct 23 00:55 5 drwxr-xr-x 2 9754 33345 4096 Oct 23 00:55 8 drwxr-xr-x 3 9754 33345 4096 Oct 23 00:55 i 226-Options: -l 226 3 matches total Show quoted text
ftp>
I ran this piece of code: $ftp = Net::FTP->new( $ftp_host, Debug => 0) or (push @errors,("Cannot connect to $ftp_host: $@ \n")); $ftp->login($userid, $accounts{$userid}) or (push @errors, ("FTP: Cannot login ". $ftp->message."\n")); my $dirinfo_href= $ftp->dir_hashref("tt/1/2"); print Dumper $dirinfo_href; exit; And this is the output: dmslogic@scritti[/tmp] $ ./ftp_tmp.pl Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 52. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. Use of uninitialized value in hash element at /opt/home/dmslogic/lib/perl5/Net/FTP/File.pm line 56. $VAR1 = { '8' => { 'Bytes' => '4096', 'Group' => '33345', 'Owner' => '9754', 'Path' => '8', 'Last Modified Year/Time' => '00:55', 'Permissions' => 'drwxr-xr-x', 'Last Modified Day' => '23', 'Link To' => undef, 'Number of Links' => '2', 'Last Modified Month' => 'Oct' }, '' => { 'Bytes' => '4096', 'Group' => '33345', 'Owner' => '9754', 'Path' => undef, 'Last Modified Year/Time' => '00:55', 'Permissions' => 'drwxr-xr-x', 'Last Modified Day' => '23', 'Link To' => undef, 'Number of Links' => '4', 'Last Modified Month' => 'Oct' }, 'i' => { 'Bytes' => '4096', 'Group' => '33345', 'Owner' => '9754', 'Path' => 'i', 'Last Modified Year/Time' => '00:55', 'Permissions' => 'drwxr-xr-x', 'Last Modified Day' => '23', 'Link To' => undef, 'Number of Links' => '3', 'Last Modified Month' => 'Oct' } }; You see, directory 5 is not read. I think that it is because it is a 1 letter word and that substr in the module is deleting it. Continuing, if I replace directory "i" with the name "3" the situation gets even worse. Show quoted text
ftp> rename i 3
350 RNFR accepted - file exists, ready for destination 250 File successfully renamed or moved Show quoted text
ftp> dir
200 PORT command successful 150 Connecting to port 29684 drwxr-xr-x 3 9754 33345 4096 Oct 23 00:55 3 drwxr-xr-x 4 9754 33345 4096 Oct 23 00:55 5 drwxr-xr-x 2 9754 33345 4096 Oct 23 00:55 8 226-Options: -l 226 3 matches total Show quoted text
ftp>
Running the code: $VAR1 = { '8' => { 'Bytes' => '4096', 'Group' => '33345', 'Owner' => '9754', 'Path' => '8', 'Last Modified Year/Time' => '00:55', 'Permissions' => 'drwxr-xr-x', 'Last Modified Day' => '23', 'Link To' => undef, 'Number of Links' => '2', 'Last Modified Month' => 'Oct' }, '' => { 'Bytes' => '4096', 'Group' => '33345', 'Owner' => '9754', 'Path' => undef, 'Last Modified Year/Time' => '00:55', 'Permissions' => 'drwxr-xr-x', 'Last Modified Day' => '23', 'Link To' => undef, 'Number of Links' => '4', 'Last Modified Month' => 'Oct' }, ' 3 ' => { 'Bytes' => '4096', 'Group' => '33345', 'Owner' => '9754', 'Path' => ' 3 ', 'Last Modified Year/Time' => '00:55', 'Permissions' => 'drwxr-xr-x', 'Last Modified Day' => '23', 'Link To' => undef, 'Number of Links' => '3', 'Last Modified Month' => 'Oct' } }; There are empty spaces around 3, which i guess is ok? i can remove those myself. But the directory name 5 is not even read. If the directory names are 2 or more characters then everything becomes fine. Thanks.