Skip Menu |
 

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 48260
Status: open
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: tom.shaw [...] solidsystems.com.au
Cc: jsremba [...] gfs.com
AdminCc:

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



Subject: Undefined value Net-FTP-2.77 dataconn.pm line 54
Date: Tue, 28 Jul 2009 11:32:07 +0800
To: bug-libnet [...] rt.cpan.org
From: Tom Shaw <tom.shaw [...] solidsystems.com.au>
Download (untitled) / with headers
text/plain 5.7k
Perl: **This is perl, v5.8.9 built for sun4-solaris OS: SunOS hubint 5.10 Generic_141414-01 sun4u sparc SUNW,SPARC-Enterprise Error: Can't use an undefined value as a symbol reference at /opt/WNGperl5/lib/5.8.9/Net/FTP/dataconn.pm line 54. Also seen using the built-in Perl 5.8.4 from Solaris 10 on a different SPARC machine. The server is "Microsoft FTP Service" This seems to be a race condition caused by using the $ftp->list($filename) method. It is likely I am using this method incorrectly, and not handling the dataconn correctly - if so, can I suggest that the documentation be updated to advise users that the "low-level" functions like $ftp->list can interfere with other Net::FTP commands if they are not handled correctly. The documentation currently says: If for some reason you want to have complete control over the data connection, this includes generating it and calling the response method when required, then the user can use these methods to do so. However calling these methods only affects the use of the methods above that can return a data connection. They have no effect on methods get, put, put_unique and those that do not require data connections. "These methods" is ambiguous - I assume it means the methods listed above. It seems that the second paragraph here is incorrect as "these methods" do affect the other methods. There arre a few posts on various forums about the line 54 error, as yet not answered. *Steps to reproduce* #!/usr/bin/perl -w use strict; use Net::FTP; my $host="hostname"; my $server="server"; my $uname ="user"; my $pword ="password"; my $rdir ="directory"; my $filename1 = "test1"; my $filename2 = "test2"; my $ftp = Net::FTP->new($server, Debug => 1) or die ("Could not connect to server $server"); $ftp->login($uname,$pword) or die ("$host cannot login to server $server: " . $ftp->message); $ftp->cwd("$rdir") or exitscript($ftp->code(),"$host cannot change remote working directory: " . $ftp->message); $ftp->ascii or die("$host cannot set transfer mode: " . $ftp->message); $ftp->put($filename1); $ftp->list($filename1); $ftp->put($filename2); $ftp->list($filename2); $ftp->quit(); exit 1; *Output* (using the debugger to get a good stack trace) # perl -d 1.pl Loading DB routines from perl5db.pl version 1.31 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(1.pl:7): my $host="hostname"; DB<1> c Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.63) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.30) Net::FTP>>> IO::Handle(1.27) Net::FTP=GLOB(0x23d944)<<< 220 Microsoft FTP Service Net::FTP=GLOB(0x23d944)>>> USER username Net::FTP=GLOB(0x23d944)<<< 331 Password required for username. Net::FTP=GLOB(0x23d944)>>> PASS .... Net::FTP=GLOB(0x23d944)<<< 230 User username logged in. Net::FTP=GLOB(0x23d944)>>> CWD directory Net::FTP=GLOB(0x23d944)<<< 250 CWD command successful. Net::FTP=GLOB(0x23d944)>>> TYPE A Net::FTP=GLOB(0x23d944)<<< 200 Type set to A. Net::FTP=GLOB(0x23d944)>>> ALLO 6 Net::FTP=GLOB(0x23d944)<<< 200 ALLO command successful. Net::FTP=GLOB(0x23d944)>>> PASV Net::FTP=GLOB(0x23d944)<<< 227 Entering Passive Mode (10,210,188,202,14,196). Net::FTP=GLOB(0x23d944)>>> STOR test1 Net::FTP=GLOB(0x23d944)<<< 125 Data connection already open; Transfer starting. Net::FTP=GLOB(0x23d944)<<< 226 Transfer complete. Net::FTP=GLOB(0x23d944)>>> PASV Net::FTP=GLOB(0x23d944)<<< 227 Entering Passive Mode (10,210,188,202,14,197). Net::FTP=GLOB(0x23d944)>>> LIST test1 Net::FTP=GLOB(0x23d944)<<< 125 Data connection already open; Transfer starting. Net::FTP=GLOB(0x23d944)>>> ALLO 6 Net::FTP=GLOB(0x23d944)<<< 226 Transfer complete. Net::FTP=GLOB(0x23d944)>>> PASV Net::FTP=GLOB(0x23d944)<<< 200 ALLO command successful. Net::FTP=GLOB(0x23d944)>>> PASV Net::FTP=GLOB(0x23d944)<<< 227 Entering Passive Mode (10,210,188,202,14,198). Net::FTP=GLOB(0x23d944)>>> LIST test2 Can't use an undefined value as a symbol reference at /opt/WNGperl5/lib/5.8.9/Net/FTP/dataconn.pm line 54. at /opt/WNGperl5/lib/5.8.9/Net/FTP/dataconn.pm line 54 Net::FTP::dataconn::_close('Net::FTP::A=GLOB(0x5aeb8c)') called at /opt/WNGperl5/lib/5.8.9/Net/FTP/dataconn.pm line 70 Net::FTP::dataconn::close('Net::FTP::A=GLOB(0x5aeb8c)') called at /opt/WNGperl5/lib/5.8.9/sun4-solaris/IO/Socket/INET.pm line 118 IO::Socket::INET::_error('Net::FTP::A=GLOB(0x5aeb8c)', 'Illegal seek', '') called at /opt/WNGperl5/lib/5.8.9/sun4-solaris/IO/Socket/INET.pm line 237 IO::Socket::INET::configure('Net::FTP::A=GLOB(0x5aeb8c)', 'HASH(0x5ca910)') called at /opt/WNGperl5/lib/5.8.9/sun4-solaris/IO/Socket.pm line 48 IO::Socket::new('Net::FTP::A', 'PeerAddr', 10.210.188.202, 'PeerPort', 3782, 'LocalAddr', undef, 'Proto', 'tcp', ...) called at /opt/WNGperl5/lib/5.8.9/sun4-solaris/IO/Socket/INET.pm line 37 IO::Socket::INET::new('Net::FTP::A', 'PeerAddr', 10.210.188.202, 'PeerPort', 3782, 'LocalAddr', undef, 'Proto', 'tcp', ...) called at /opt/WNGperl5/lib/5.8.9/Net/FTP.pm line 932 Net::FTP::_dataconn('Net::FTP=GLOB(0x23d944)') called at /opt/WNGperl5/lib/5.8.9/Net/FTP.pm line 1014 Net::FTP::_data_cmd('Net::FTP=GLOB(0x23d944)', 'LIST', 'test2') called at /opt/WNGperl5/lib/5.8.9/Net/FTP.pm line 677 Net::FTP::list('Net::FTP=GLOB(0x23d944)', 'test2') called at 1.pl line 30 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<1> Note: this dies at the second "list" command. The FTP status codes etc have become out-of-order. Alternatively, if I am conscientious at doing: $ftp->put($filename) or die ... then the script dies at "Unable to put test2". Regards Tom Shaw
Download (untitled) / with headers
text/plain 142b
This appears to be a duplicate of bug #37700, which had a patch attached to fix this problem over a year ago. Is anyone maintaining Net::FTP?
Subject: Re: [rt.cpan.org #48260] Undefined value Net-FTP-2.77 dataconn.pm line 54
Date: Tue, 22 Sep 2009 10:38:57 -0500
To: bug-libnet [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
Download (untitled) / with headers
text/plain 514b
On Sep 22, 2009, at 9:41 AM, Deven T. Corzine via RT wrote: Show quoted text
> Queue: libnet > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48260 > > > This appears to be a duplicate of bug #37700, which had a patch > attached > to fix this problem over a year ago. Is anyone maintaining Net::FTP?
It is true that libnet has been neglected for a while, but I hope to dig through all the backlog soon. If you would like to help, the repository is on github @ http://github.com/gbarr/perl-libnet Graham.
Download (untitled) / with headers
text/plain 190b
The bug which this has been commented is a duplicate of (namely, #37700) should now be fixed in 1.22_02. Please can you try that release and report back whether it fixes this bug? Thank you.
Download (untitled) / with headers
text/plain 2.3k
On Thu Aug 08 13:03:27 2013, SHAY wrote: Show quoted text
> The bug which this has been commented is a duplicate of (namely, > #37700) should now be fixed in 1.22_02. Please can you try that > release and report back whether it fixes this bug? Thank you.
I have now tried this myself, and #37700 does not fix this bug involving the use of list(). The test program no longer complains "Can't use an undefined value as a symbol reference" (which is what #37700 fixed), but the list() still fails, prematurely exiting the script without transferring the second file: C:\Dev\Temp>perl test.pl Net::FTP>>> Net::FTP(2.79) Net::FTP>>> Exporter(5.68) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.33) Net::FTP>>> IO::Socket(1.36) Net::FTP>>> IO::Handle(1.34) Net::FTP=GLOB(0x26dc1d8)<<< 220-FileZilla Server version 0.9.43 beta Net::FTP=GLOB(0x26dc1d8)<<< 220-written by Tim Kosse (tim.kosse@filezilla-projec t.org) Net::FTP=GLOB(0x26dc1d8)<<< 220 Please visit http://sourceforge.net/projects/fil ezilla/ Net::FTP=GLOB(0x26dc1d8)>>> USER anonymous Net::FTP=GLOB(0x26dc1d8)<<< 331 Password required for anonymous Net::FTP=GLOB(0x26dc1d8)>>> PASS .... Net::FTP=GLOB(0x26dc1d8)<<< 230 Logged on Net::FTP=GLOB(0x26dc1d8)>>> CWD foo Net::FTP=GLOB(0x26dc1d8)<<< 250 CWD successful. "/foo" is current directory. Net::FTP=GLOB(0x26dc1d8)>>> TYPE A Net::FTP=GLOB(0x26dc1d8)<<< 200 Type set to A Net::FTP=GLOB(0x26dc1d8)>>> PASV Net::FTP=GLOB(0x26dc1d8)<<< 227 Entering Passive Mode (127,0,0,1,243,220) Net::FTP=GLOB(0x26dc1d8)>>> STOR a.txt Net::FTP=GLOB(0x26dc1d8)<<< 150 Opening data channel for file upload to server o f "/foo/a.txt" Net::FTP=GLOB(0x26dc1d8)<<< 226 Successfully transferred "/foo/a.txt" Net::FTP=GLOB(0x26dc1d8)>>> PASV Net::FTP=GLOB(0x26dc1d8)<<< 227 Entering Passive Mode (127,0,0,1,243,222) Net::FTP=GLOB(0x26dc1d8)>>> LIST a.txt Net::FTP=GLOB(0x26dc1d8)<<< 150 Opening data channel for directory listing of "/ foo/a.txt" Net::FTP=GLOB(0x26dc1d8)>>> PASV Net::FTP=GLOB(0x26dc1d8)<<< 226 Successfully transferred "/foo/a.txt" Net::FTP=GLOB(0x26dc1d8)>>> PASV Net::FTP=GLOB(0x26dc1d8)<<< 227 Entering Passive Mode (127,0,0,1,243,224) Net::FTP=GLOB(0x26dc1d8)>>> QUIT Net::FTP=GLOB(0x26dc1d8)<<< 227 Entering Passive Mode (127,0,0,1,243,225) The script completes normally using ls() instead of list() so it is surely something amiss with list() here - an entirely separate bug to #37700.
As with #50371, setting FTP_PASSIVE=0 fixes this problem...


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.