Subject: | ls -l doesn't show a directory named "0" [zero] |
Date: | Wed, 19 Sep 2007 23:41:02 -0700 |
To: | bug-Net-FTPServer [...] rt.cpan.org |
From: | "Ravi Cheema" <ravi.cheema [...] gmail.com> |
ls -l doesn't show directory named "0" [zero] See example below
==============
Possible BUG:
==============
[cheema@localhost ~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost
220 localhost FTP server (Net::FTPServer/1.122-1) ready.
Name (localhost:cheema):
331 Username OK, please send password.
Password:
230 Welcome cheema.
Remote system type is UNIX.
Using binary mode to transfer files.
Show quoted text
ftp> cd test
250 Changed directory OK.
Show quoted textftp> mkdir 0
250 Directory has been created.
Show quoted textftp> mkdir 1
250 Directory has been created.
Show quoted textftp> ls -l
500 Unrecognized command.
227 Entering Passive Mode (127,0,0,1,216,31)
150 Opening data connection for file listing.
total 1
drwxr-xr-x 4 - - 512 Sep 20 13:17 .
drwxr-xr-x 10 - - 512 Sep 20 13:15 ..
drwxr-xr-x 2 - - 512 Sep 20 13:17
<<================ [BUG: This should be "0", its blank]
drwxr-xr-x 2 - - 512 Sep 20 13:17 1
226 Listing complete. Data connection has been closed.
Show quoted textftp> pwd
Remote directory: /test
Show quoted textftp> cd 0
250 Changed directory OK.
Show quoted textftp> pwd
Remote directory: /test/0
Show quoted textftp>
==============================
Possible FIX or WORKAROUND
==============================
NOt sure if there is another better way of doing this, but I've found a
workaround by adding a carriage return in the "FTPServer.pm" file
Change Line: 5905 in /usr/local/lib/perl5/site_perl/5.8.8/Net/FTPServer.pm
$self->_list_file ($sock, $handle, $prefix . $filename, $statusref);
to
$self->_list_file ($sock, $handle, $prefix . $filename . "\r", $statusref);
Here is the diff of the files original and modified "FTPServer.pm"
[cheema@localhost ~]# diff -u FTPServer.pm.orig FTPServer.pm
--- FTPServer.pm.orig Thu Sep 20 06:25:53 2007
+++ FTPServer.pm Thu Sep 20 06:25:21 2007
@@ -5902,7 +5902,7 @@
my $handle = $_->[1];
my $statusref = $_->[2];
- $self->_list_file ($sock, $handle, $prefix . $filename,
$statusref);
+ $self->_list_file ($sock, $handle, $prefix . $filename . "\r",
$statusref);
}
}
==============
VERSIONS:
==============
Here is the version of Perl and Net::FTPServer that I'm running.
[cheema@localhost ~]# perl -v
This is perl, v5.8.8 built for i386-freebsd-64int
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[cheema@localhost ~]# /usr/local/sbin/ftpd.pl -V
Net::FTPServer/1.122-1