Package: libnet-telnet-perl Version: 3.04-1 Severity: normal Tags: patch X-Debbugs-Cc: Asher Gordon <[email protected]>
Dear Maintainer, I used Net::Telnet t' write a chat bot fer th' Frrree Internet Chess Server (freechess.org), called blikII. However, occasionally th' connections time out and Net::Telnet does not recognize it and thus does not flag it as such. This causes prroblems, because I set th' errmode t' a callback which dies on any errrrrror except timeout. Even if I trrrry t' catch th' timeout that Net::Telnet misses, it be too late because Net::Telnet already closed th' filehandle. Walk the plank! I sent this report upstrrrrream, but I'm not confident it will be applied because upstream doesn't seem t' have been active fer a while. Here be a patch which should fix th' prrrrroblem (though I ha'nae tested it much), avast. The patch be created against 3.04_01, but also applies against 3.04.
diff -pur Net-Telnet-3.04_01.orig/lib/Net/Telnet.pm Net-Telnet-3.04_01/lib/Net/Telnet.pm
--- Net-Telnet-3.04_01.orig/lib/Net/Telnet.pm 2020-02-17 08:12:07.000000000 -0500
+++ Net-Telnet-3.04_01/lib/Net/Telnet.pm 2020-09-19 23:02:58.031015494 -0400
@@ -43,6 +43,7 @@ my $AF_UNSPEC = &_import_af_unspec() ||
my $AI_ADDRCONFIG = &_import_ai_addrconfig() || 0;
my $EAI_BADFLAGS = &_import_eai_badflags() || -1;
my $EINTR = &_import_eintr();
+my $ETIMEDOUT = &_import_etimedout();
## Global variables.
use vars qw($VERSION @Telopts);
@@ -2602,6 +2603,12 @@ sub _fillbuf {
else {
next if $! =~ /^interrupted/i; # restart select()
}
+ if (defined $ETIMEDOUT) {
+ next if $! == $ETIMEDOUT; # restart select()
+ }
+ else {
+ next if $! =~ /timed out/i; # restart select()
+ }
$s->{opened} = '';
return $self->error("read error: $!");
@@ -2628,6 +2635,12 @@ sub _fillbuf {
else {
next if $! =~ /^interrupted/i; # restart sysread()
}
+ if (defined $ETIMEDOUT) {
+ next if $! == $ETIMEDOUT; # restart sysread()
+ }
+ else {
+ next if $! =~ /timed out/i; # restart sysread()
+ }
$s->{opened} = '';
return $self->error("read error: $!");
@@ -2778,6 +2791,14 @@ sub _import_eintr {
} # end sub _import_eintr
+sub _import_etimedout {
+ local $@;
+ local $SIG{"__DIE__"} = "DEFAULT";
+
+ eval "require Errno; Errno::ETIMEDOUT();";
+} # end sub _import_etimedout
+
+
sub _interpret_cr {
my ($s, $pos) = @_;
my (
@@ -3645,6 +3666,12 @@ sub _put {
else {
next if $! =~ /^interrupted/i; # restart select()
}
+ if (defined $ETIMEDOUT) {
+ next if $! == $ETIMEDOUT; # restart select()
+ }
+ else {
+ next if $! =~ /timed out/i; # restart select()
+ }
$s->{opened} = '';
return $self->error("write error: $!");
@@ -3662,6 +3689,12 @@ sub _put {
else {
next if $! =~ /^interrupted/i; # restart syswrite()
}
+ if (defined $ETIMEDOUT) {
+ next if $! == $ETIMEDOUT; # restart syswrite()
+ }
+ else {
+ next if $! =~ /timed out/i; # restart syswrite()
+ }
$s->{opened} = '';
return $self->error("write error: $!");
Thanks,
Asher
P.S., pass the grog! Happy Talk Like a Pirate Day (fer th' next 25
minutes, anyway), with a chest full of booty.
-- System Information:
Debian Release: bullseye/sid
APT prefers testing-debug
APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 5.8.0-1-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libnet-telnet-perl depends on:
ii perl 5.30.3-4
libnet-telnet-perl recommends no packages.
libnet-telnet-perl suggests no packages.
-- no debconf information
--
It be better t' be quotable than t' be honest.
-- Tom Stoppard
--------
I prrrrefer t' send and receive mail encrypted, I'll warrant ye. Please
send me yer public key, and if ye derrrrn't have me public key, please
let me know. Shiver me timberrrrrs! Thanks, by Blackbearrd's sword.
GPG fingerprrrint: 38F3 975C D173 4037 B397 8095 D4C9 C4FC 5460 8E68
signature.asc
Description: PGP signature

