Skip Menu |

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

Report information
The Basics
Id: 83382
Status: resolved
Priority: 0/
Queue: Net-Telnet

People
Owner: Nobody in particular
Requestors: greearb [...] candelatech.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 3.03
Fixed in: 3.04



Subject: 'use bigint' breaks Net::Telnet
I have a script that uses waitfor('foo'). I was also trying to use 64-bit numbers on 32-bit systems, so I put 'use bigint' at the top. Strange enough, that breaks the waitfor call (at least). From an strace, it appears a bad value is being given to select..maybe the timeout is bad? It works fine if I remove the 'use bigint' line. .... connect(4, {sa_family=AF_INET, sin_port=htons(4001), sin_addr=inet_addr("192.168.100.138")}, 16) = 0 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 rt_sigaction(SIGALRM, {SIG_DFL, [], 0}, {0x48a260, [], 0}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 alarm(0) = 0 fstat64(4, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0 time(NULL) = 1361058694 time(NULL) = 1361058694 select(8, [4], NULL, NULL, {2147483648, 2147483648}) = -1 EINVAL (Invalid argument) I see this bug on Fedora 17, 14 and Fedora 13, at least.
Subject: Re: [rt.cpan.org #83382] 'use bigint' breaks Net::Telnet
Date: Tue, 19 Feb 2013 14:04:14 -0500
To: bug-Net-Telnet [...] rt.cpan.org
From: Jay Rogers <jay [...] rgrs.com>
Ben, thanks for your report. Could you provide sample code that replicates this problem, along with the version of perl used? -- Jay Rogers
Subject: Re: [rt.cpan.org #83382] 'use bigint' breaks Net::Telnet
Date: Tue, 19 Feb 2013 11:13:25 -0800
To: bug-Net-Telnet [...] rt.cpan.org
From: Ben Greear <greearb [...] candelatech.com>
On 02/19/2013 11:04 AM, Jay Rogers via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=83382 > > > Ben, thanks for your report. > > Could you provide sample code that replicates this problem, > along with the version of perl used? > > -- > Jay Rogers >
Here's sample code. I imagine it would work with normal telnet server as well, but as written, it uses values for my particular application. Let me know if you have any trouble reproducing this. Comment out the 'use bigint' and it will work. [greearb@ben-dt2 tmp]$ /mnt/fs3/greearb/tmp/ntbigint.pl read error: Invalid argument at /mnt/fs3/greearb/tmp/ntbigint.pl line 35 [greearb@ben-dt2 tmp]$ perl --version This is perl 5, version 14, subversion 3 (v5.14.3) built for x86_64-linux-thread-multi #!/usr/bin/perl # Un-buffer output $| = 1; # This breaks Net::Telnet...gah! use bigint; use strict; use Net::Telnet (); my $lfmgr_host = "192.168.100.138"; my $lfmgr_port = "4001"; # Open connection to the LANforge server. my $t = new Net::Telnet(Timeout => 15, #Dump_Log => "foo.log", Prompt => '/default\@btbits\>\>/'); $t->telnetmode(0); # Not true telnet protocol $t->max_buffer_length(1024 * 1024 * 10); # 10M buffer $t->open(Host => $lfmgr_host, Port => $lfmgr_port, Timeout => 45); $t->waitfor('/.*btbits\>\>.*/'); Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com
Subject: Re: [rt.cpan.org #83382] 'use bigint' breaks Net::Telnet
Date: Tue, 19 Feb 2013 14:20:49 -0500
To: bug-Net-Telnet [...] rt.cpan.org
From: Jay Rogers <jay [...] rgrs.com>
Could you explain what the problem is? -- Jay Rogers
Subject: Re: [rt.cpan.org #83382] 'use bigint' breaks Net::Telnet
Date: Tue, 19 Feb 2013 11:34:46 -0800
To: bug-Net-Telnet [...] rt.cpan.org
From: Ben Greear <greearb [...] candelatech.com>
On 02/19/2013 11:20 AM, Jay Rogers via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=83382 > > > Could you explain what the problem is?
You get the 'invalid argument' error in the 'waitfor' method. If you run strace on the perl script, you'll see it dies in the select() system call, maybe because the timeout value is bogus. Are you able to reproduce the problem? Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com
Subject: Re: [rt.cpan.org #83382] 'use bigint' breaks Net::Telnet
Date: Tue, 19 Feb 2013 22:38:58 -0500
To: bug-Net-Telnet [...] rt.cpan.org
From: Jay Rogers <jay [...] rgrs.com>
I have been able to replicate this problem. The problem is, when using bigint, Net::Telnet will fail to block for the timeout seconds while waiting for input to read This appears to be a bug in perl itself involving the use of a Math::BigInt timeout arg for select(). When I get some time I'll create sample code to replicate the problem without using Net::Telnet. Here's the code that replicates the problem with Net::Telnet: use bigint; use Net::Telnet (); my $t = new Net::Telnet (-timeout => 5, -errmode => "return"); $t->open(-host => "127.0.0.1", -port => 22); ## print() statements should execute 5 secs apart. print scalar(localtime), "\n"; $t->waitfor('/nothing/'); print scalar(localtime), "\n"; The workaround is, when "use bigint;", to specify the timeout as a scalar using Math::BigInt::numify(), e.g. for a timeout of 5 secs: -timeout => Math::BigInt::numify(5)
Subject: Re: [rt.cpan.org #83382] 'use bigint' breaks Net::Telnet
Date: Wed, 20 Feb 2013 22:47:08 -0500
To: bug-Net-Telnet [...] rt.cpan.org
From: Jay Rogers <jay [...] rgrs.com>
I filed a perl bug report for this problem [perl #116889]. I found a workaround for the bug and Net::Telnet is fixed in the development version for 3.04. You can find the development version at ftp://ftp.rgrs.com