Browse files

[ #79745] nick_long_form dies due to a race condition

Wed Sep 19 06:21:03 2012: Request 79745 was acted upon.
Transaction: Ticket created by
       Queue: POE-Component-IRC
     Subject: nick_long_form dies due to a race condition
   Broken in: 6.78
    Severity: Normal
       Owner: Nobody
      Status: new
 Ticket <URL: >

I'm using POE::Component::IRC::State. When somebody joins, their nick is added to the state, and a WHO command is issued. If you call `$irc->nick_long_form('that_guy')` before the
WHO reply is received [ i.e. before the nick is synced ], `nick_long_form` will die because the user and the host are not in the state.

The documentation does not say what should happen in this case, but I'd say nick_long_form should return false.

The fix would be to add the following line between lines 882 and 883 of POE/Component/IRC/
    return unless exists $user->{User} && exists $user->{Host};

System information:
I'm using POE-Component-IRC 6.78 from the Debian repos [ package libpoe-component-irc-perl version 6.78+dfsg-1 ]. I did not test other versions.

I'm using perl from the Debian repos [ package perl version 5.14.2-13 ]. `perl -v` says:
This is perl 5, version 14, subversion 2 (v5.14.2) built for i486-linux-gnu-thread-multi-64int
(with 62 registered patches, see perl -V for more detail)

`uname -a` says: Linux 3.3.0 #4 Tue Jun 19 09:52:46 EEST 2012 i686 GNU/Linux
  • Loading branch information...
1 parent bdfa9c6 commit d05ef95d57cc797aa18047589d912c7aed4795ef @bingos committed Sep 19, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/POE/Component/IRC/
@@ -874,6 +874,7 @@ sub nick_long_form {
return if !$self->_nick_exists($nick);
my $user = $self->{STATE}{Nicks}{ $unick };
+ return unless exists $user->{User} && exists $user->{Host};
return "$user->{Nick}!$user->{User}\@$user->{Host}";

0 comments on commit d05ef95

Please sign in to comment.