Skip Menu |

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

Report information
The Basics
Id: 19666
Status: rejected
Priority: 0/
Queue: Net-FTP-Recursive

People
Owner: texasjdl [...] yahoo.com
Requestors: lars [...] abusiness.dk
Cc:
AdminCc:

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



Subject: Problem when ls -al returns the modified date as YYYY-mm-dd
Hello This is my first time debugging anything so please bare with me if I'm off road. I've successfully installed Net::FTP:Recursive on a FreeBSD server in the past and used a single rput script to make some backups. Today I installed it on a Debian Linux but couldn't get my FTP script to work. Seemed like rput wasn't handled at all. This is what the rput sample script logs: Net::FTP>>> Net::FTP(2.75) Net::FTP>>> Exporter(5.58) Net::FTP>>> Net::Cmd(2.26) Net::FTP>>> IO::Socket::INET(1.27) Net::FTP>>> IO::Socket(1.28) Net::FTP>>> IO::Handle(1.24) Net::FTP=GLOB(0x816674c)<<< 220 Microsoft FTP Service Net::FTP::Recursive=GLOB(0x816674c)>>> user administrator Net::FTP::Recursive=GLOB(0x816674c)<<< 331 Password required for administrator. Net::FTP::Recursive=GLOB(0x816674c)>>> PASS .... Net::FTP::Recursive=GLOB(0x816674c)<<< 230 User administrator logged in. Net::FTP::Recursive=GLOB(0x816674c)>>> TYPE I Net::FTP::Recursive=GLOB(0x816674c)<<< 200 Type set to I. Net::FTP::Recursive=GLOB(0x816674c)>>> CWD /Backups/MYSQL/SQL Net::FTP::Recursive=GLOB(0x816674c)<<< 250 CWD command successful. Net::FTP::Recursive=GLOB(0x816674c)>>> PWD Net::FTP::Recursive=GLOB(0x816674c)<<< 257 "/Backups/MYSQL/SQL" is current directory. Net::FTP::Recursive=GLOB(0x816674c)>>> QUIT Net::FTP::Recursive=GLOB(0x816674c)<<< 221 Se the blank line in the debug log (?) that should have been the put or rput command. So I started looking in the Recursive.pm file making som debug print tests to se how far it got. I ended up in the sub parse_files(). Here you split up the dir command ls -la: $line =~ /^ (\S+)\s+ #permissions %p (\d+)\s+ #link count %lc (\S+)\s+ #user owner %u (\S+)\s+ #group owner %g (\d+)\s+ #size %s (\w+\s+\w+\s+\S+)\s+ #last modification date %d (.+?)\s* #filename %f (?:->\s*(.+))? #optional link part %l $ /x; This match dir lines fine on a FreeBSD, but not on my Debian Linux. Below an ls -la command from FreeBSD: bash-2.05# ls -la total 56786 drwxr-xr-x 2 root wheel 1024 16 Nov 2005 . drwxr-xr-x 10 root wheel 1024 17 Maj 12:40 .. -rw-r--r-- 1 root wheel 3236690 16 Nov 2005 ftpd.log -rw-r--r-- 1 root wheel 4254271 16 Nov 2005 ftpd.log.0 -rw-r--r-- 1 root wheel 13 3 Jun 01:48 test.txt Below an ls -la command from Debian Linux: mysql5:/downloads/Net-FTP-Recursive-2.00# ls -la totalt 200 drwxr-xr-x 5 root root 4096 2006-06-03 01:42 . drwxr-xr-x 8 root root 4096 2006-06-03 01:20 .. drwxr-xr-x 5 root root 4096 2006-06-03 01:08 blib -rw-rw-r-- 1 500 500 3106 2005-04-13 06:06 Changes As you can see this dateformat is different by containing hyphens and not whitespaces. So I modified the part where it strips the modification date: (\w+\s+\w+\s+\S+|\d+-\d+-\d+\s+\S+)\s+ #last modification date %d You could write that in other ways how ever this works in my case. I hope this was helpfull. Best regards Lars Skjoldby http://www.abusiness.dk
The ParseSub option to all of the methods is the way you can easily get around this limitation. Unfortunately, since FTP only uses text to return results to the client, this is a pervasive problem with no good solution. So the solution I've provided is to provide your own parsing routine so that the module can use that routine instead of the default. In that parsing routine, you can provide your own regex for splitting up the string returned by your particular FTP server. The easiest way to create a parsing routine is to use the parse_files() routine in the module as a template. Unfortunately, since perl does not allow named capture (well, without a module anyway), it is not possible just to provide a regex to the module for use in parsing (that would assume that the difference pieces are always in the same order). Please email with any more questions/issues. On Fri Jun 02 20:22:29 2006, guest wrote: Show quoted text
> Hello > This is my first time debugging anything so please bare with me if I'm > off road. > > I've successfully installed Net::FTP:Recursive on a FreeBSD server in > the past and used a single rput script to make some backups. Today I > installed it on a Debian Linux but couldn't get my FTP script to work. > Seemed like rput wasn't handled at all. This is what the rput sample > script logs: > Net::FTP>>> Net::FTP(2.75) > Net::FTP>>> Exporter(5.58) > Net::FTP>>> Net::Cmd(2.26) > Net::FTP>>> IO::Socket::INET(1.27) > Net::FTP>>> IO::Socket(1.28) > Net::FTP>>> IO::Handle(1.24) > Net::FTP=GLOB(0x816674c)<<< 220 Microsoft FTP Service > Net::FTP::Recursive=GLOB(0x816674c)>>> user administrator > Net::FTP::Recursive=GLOB(0x816674c)<<< 331 Password required for > administrator. > Net::FTP::Recursive=GLOB(0x816674c)>>> PASS .... > Net::FTP::Recursive=GLOB(0x816674c)<<< 230 User administrator logged > in. > Net::FTP::Recursive=GLOB(0x816674c)>>> TYPE I > Net::FTP::Recursive=GLOB(0x816674c)<<< 200 Type set to I. > Net::FTP::Recursive=GLOB(0x816674c)>>> CWD /Backups/MYSQL/SQL > Net::FTP::Recursive=GLOB(0x816674c)<<< 250 CWD command successful. > > Net::FTP::Recursive=GLOB(0x816674c)>>> PWD > Net::FTP::Recursive=GLOB(0x816674c)<<< 257 "/Backups/MYSQL/SQL" is > current directory. > Net::FTP::Recursive=GLOB(0x816674c)>>> QUIT > Net::FTP::Recursive=GLOB(0x816674c)<<< 221 > > Se the blank line in the debug log (?) that should have been the put > or rput command. > > So I started looking in the Recursive.pm file making som debug print > tests to se how far it got. I ended up in the sub parse_files(). Here > you split up the dir command ls -la: > $line =~ /^ > (\S+)\s+ #permissions %p > (\d+)\s+ #link count %lc > (\S+)\s+ #user owner %u > (\S+)\s+ #group owner %g > (\d+)\s+ #size %s > (\w+\s+\w+\s+\S+)\s+ #last modification date %d > (.+?)\s* #filename %f > (?:->\s*(.+))? #optional link part %l > $ > /x; > > This match dir lines fine on a FreeBSD, but not on my Debian Linux. > > Below an ls -la command from FreeBSD: > bash-2.05# ls -la > total 56786 > drwxr-xr-x 2 root wheel 1024 16 Nov 2005 . > drwxr-xr-x 10 root wheel 1024 17 Maj 12:40 .. > -rw-r--r-- 1 root wheel 3236690 16 Nov 2005 ftpd.log > -rw-r--r-- 1 root wheel 4254271 16 Nov 2005 ftpd.log.0 > -rw-r--r-- 1 root wheel 13 3 Jun 01:48 test.txt > > Below an ls -la command from Debian Linux: > > mysql5:/downloads/Net-FTP-Recursive-2.00# ls -la > totalt 200 > drwxr-xr-x 5 root root 4096 2006-06-03 01:42 . > drwxr-xr-x 8 root root 4096 2006-06-03 01:20 .. > drwxr-xr-x 5 root root 4096 2006-06-03 01:08 blib > -rw-rw-r-- 1 500 500 3106 2005-04-13 06:06 Changes > > As you can see this dateformat is different by containing hyphens and > not whitespaces. So I modified the part where it strips the > modification date: > (\w+\s+\w+\s+\S+|\d+-\d+-\d+\s+\S+)\s+ #last modification date %d > > You could write that in other ways how ever this works in my case. > > I hope this was helpfull. > > Best regards > Lars Skjoldby > http://www.abusiness.dk >