Skip Menu |
 

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

Report information
The Basics
Id: 131849
Status: patched
Priority: 0/
Queue: Net-Telnet

People
Owner: Nobody in particular
Requestors: DLAMBLEY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 3.03
  • 3.04
Fixed in: (no value)



Subject: Fix for Net::Telnet sabotaging IO handles in perl 5.10
Download (untitled) / with headers
text/plain 572b
Hello, The compatibility for ancient perls in supporting both IO::Handle and Filehandle causes filehandles to be broken in 5.10.1 unless you explicitly pull in Filehandle.pm. The attached patch fixes this by removing this compatibility, as pre 5.6 perls are unlikely to be of interest these days. I have pushed a development release to get feedback from CPAN Testers, http://matrix.cpantesters.org/?dist=Net-Telnet+3.04_01 I have also created a git repository containing this and a POD fix which you may pull from, https://repo.or.cz/Net-Telnet.git Best regards, Dave
Subject: io.diff
Download io.diff
text/x-diff 2.7k
commit fb801ca53ad5028203c27a29b05a16c436d18906 Author: Dave Lambley <dave@lambley.me.uk> Date: Mon Feb 17 13:05:08 2020 +0000 Avoid breaking IO::Handle methods in Perl 5.10.1 From perl5120delta, "Filehandles are now always blessed into IO::File." IO::Socket::INET was added to core in 5.6.0, so we should be able to rely on it being present. diff --git a/ChangeLog b/ChangeLog index 3950fc9..7cb88ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ + * Break ancient perl compatibility, fix 5.10.1. + 2013-04-21 Jay Rogers <jay@rgrs.com> * Version 3.04 released. diff --git a/Makefile.PL b/Makefile.PL index 490b47d..3eb0171 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,10 +1,22 @@ ## -*- Perl -*- +use v5.6; use ExtUtils::MakeMaker qw(WriteMakefile); WriteMakefile(NAME => "Net::Telnet", DISTNAME => "Net-Telnet", VERSION_FROM => "lib/Net/Telnet.pm", + PREREQ_PM => { + "IO::Handle" => 0, + "IO::Socket::INET" => 0, + "Socket" => 0, + "Symbol" => 0, + "parent" => 0, + }, + TEST_REQUIRES => { + "Test::More" => 0, + "Test::Exception" => 0, + }, dist => { COMPRESS => "gzip", SUFFIX => "gz" }, ($] >= 5.005 ? (ABSTRACT => "Interact with TELNET port or other TCP ports", diff --git a/lib/Net/Telnet.pm b/lib/Net/Telnet.pm index f0f20fb..eb9b3df 100644 --- a/lib/Net/Telnet.pm +++ b/lib/Net/Telnet.pm @@ -29,20 +29,15 @@ use vars qw(@EXPORT_OK); TELOPT_EXOPL); ## Module import. +use IO::Socket::INET; +use IO::Handle; use Exporter (); use Socket qw(AF_INET SOCK_STREAM inet_aton sockaddr_in); use Symbol qw(qualify); ## Base classes. -use vars qw(@ISA); -@ISA = qw(Exporter); -if (&_io_socket_include) { # successfully required module IO::Socket - push @ISA, "IO::Socket::INET"; -} -else { # perl version < 5.004 - require FileHandle; - push @ISA, "FileHandle"; -} +use parent qw/ Exporter IO::Socket::INET /; + my $AF_INET6 = &_import_af_inet6(); my $AF_UNSPEC = &_import_af_unspec() || 0; my $AI_ADDRCONFIG = &_import_ai_addrconfig() || 0; @@ -3311,13 +3306,7 @@ sub _negotiate_recv_enable { sub _new_handle { - if ($INC{"IO/Handle.pm"}) { - return IO::Handle->new; - } - else { - require FileHandle; - return FileHandle->new; - } + return IO::Handle->new; } # end sub _new_handle diff --git a/t/eat-filehandle.t b/t/eat-filehandle.t new file mode 100644 index 0000000..07c21b0 --- /dev/null +++ b/t/eat-filehandle.t @@ -0,0 +1,13 @@ +#!/usr/bin/env perl + +use Test::More; +use Test::Exception; +use Net::Telnet; +use IO::Handle; + + +open(my $fh, "<", "/dev/zero") or die $!; + +lives_ok { $fh->untaint }; + +done_testing();
Download (untitled) / with headers
text/plain 374b
On Mon Feb 17 08:35:15 2020, DLAMBLEY wrote: Show quoted text
> Hello, > > The compatibility for ancient perls in supporting both IO::Handle and > Filehandle causes filehandles to be broken in 5.10.1 unless you > explicitly pull in Filehandle.pm.
The lost compatibility relates to this change, https://metacpan.org/pod/perl5004delta#Internal-change:-FileHandle-class-based-on-IO::*-classes
Download (untitled) / with headers
text/plain 226b
Thanks for your feedback. I appreciate it. perl 5.10.1 was released a long time ago. I am not aware of any IO::Handle or Filehandle problems with Net::Telnet and perl 5.10.1. Please provide code demonstrating the problem.
Download (untitled) / with headers
text/plain 1.2k
On Mon Feb 17 10:56:16 2020, JROGERS wrote: Show quoted text
> Thanks for your feedback. I appreciate it. perl 5.10.1 was released > a long time ago. I am not aware of any IO::Handle or Filehandle > problems with Net::Telnet and perl 5.10.1. Please provide code > demonstrating the problem.
Hi Jay, thank you for getting back to me. In the patch above I have added t/eat-filehandle.t which reproduces the problem. You can reproduce the problem on a Centos 6 machine with the perl-Net-Telnet (this gives you version package installed. # perl -MIO::Handle -MNet::Telnet -e'open(my $fh, "<", "/dev/zero"); $fh->untaint' Can't locate object method "untaint" via package "FileHandle" at -e line 1. (I brought up a machine with docker run -it centos:6 /bin/bash) If you remove "-MNet::Telnet", you no longer get the error. I can also reproduce this on a Debian VM. The code I have simplified is for backward compatibility for Perl's before 5.4, hence lacking this change https://metacpan.org/pod/perl5004delta#Internal-change:-FileHandle-class-based-on-IO::*-classes The problem was fixed in later versions of Perl by https://perl5.git.perl.org/perl5.git/blobdiff/7c5c215e1c2227e9a83f8a692fa67abe338df835..31c9a3ace4f559b79a21319b8903e92f53b44868:/sv.c
Download (untitled) / with headers
text/plain 411b
Dave, I tracked this down to a bug in perl 5.10.1. The bug is triggered by the lexical presence of this statement even though it is not executed: require FileHandle; I am adding a workaround to Net:Telnet in the next version to eval those statements i.e. eval "require FileHandle"; I see there are some other Net::Telnet tickets I need to address. I can't tell you when the next release will be.


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.