Bug#437474: libnet-irc-perl patches

Niko Tyni ntyni at iki.fi
Sun Sep 16 18:50:35 UTC 2007


On Wed, Aug 15, 2007 at 05:15:07PM +0800, David Sobon wrote:
> 
> The first patch ('fix_ev_has_null_type.patch')... I did come across a
> few presumably non-standard IRC servers that sent unknown numeric
> codes. Your second reason seems more plausible. I think the best
> approach would be to print debugging info when $ev is undefined... to
> find out how it happened. Or example IRC servers? Any pointers?

Sorry for the delay.

I finally got around to testing this a bit, and it turns out that my IRC
server also sends out a code that's unknown to Net::IRC: 
 :<irc-server> 020 * :Please wait while we scan you for security.

With this, I came up with the attached patch. It fixes two undefined
value warnings and adds a debugging message mentioning the unknown code.

I'll include this and the 'next-versus-return' patch into the
next version and send them to the upstream bug tracker for the
benefit of other distributions.

Cheers,
-- 
Niko Tyni   ntyni at iki.fi
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## 60warnings_from_unknown_event.dpatch by Niko Tyni <ntyni at iki.fi>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix 'uninitialized value' warnings from unknown response codes.
## DP: See #437474

@DPATCH@
diff -urNad libnet-irc-perl~/Connection.pm libnet-irc-perl/Connection.pm
--- libnet-irc-perl~/Connection.pm	2007-09-16 21:35:56.000000000 +0300
+++ libnet-irc-perl/Connection.pm	2007-09-16 21:35:59.000000000 +0300
@@ -467,6 +467,7 @@
   my $ev;
   if (ref $event) {
     $ev = $event->type;
+    $ev = "" if !$ev;
   } elsif (defined $event) {
     $ev = $event;
     $event = Net::IRC::Event->new($event, '', '', '');
@@ -1126,11 +1127,15 @@
   
   $from = substr $from, 1 if $from =~ /^:/;
   
-  return Net::IRC::Event->new( $type,
+  my $event = Net::IRC::Event->new( $type,
                                $from,
                                '',
                                'server',
                                @stuff );
+  if (!$event->type and $self->{_debug}) {
+    carp("Unknown code $type received") ;
+  }
+  return $event;
 }
 
 # Helps you flee those hard-to-stand channels.
@@ -1584,6 +1589,8 @@
     croak "You EEEEEDIOT!!! Not enough args to _default()!";
   }
   
+  return 1 if !$event->type;
+
   # Reply to PING from server as quickly as possible.
   if ($event->type eq "ping") {
     $self->sl("PONG " . (CORE::join ' ', $event->args));


More information about the pkg-perl-maintainers mailing list