[Pidgin] #11431: Signals no longer work in Perl plugins

Pidgin trac at pidgin.im
Mon Feb 22 18:48:32 EST 2010


#11431: Signals no longer work in Perl plugins
---------------------+------------------------------------------------------
Reporter:  dharding  |        Type:  defect 
  Status:  new       |   Component:  plugins
 Version:  2.6.6     |    Keywords:  perl   
---------------------+------------------------------------------------------
 In Pidgin 2.6.6 on Windows XP, callbacks registered from Perl plugins get
 called with garbage arguments when they get signaled.

 I modified a plugin to log the arguments passed to a callback connected to
 the receiving-im-msg signal.  I expected to get output like the following:

 '''Purple::Account=HASH(0x203fc14), AOL System Msg, Your screen name
 (SCREEN_NAME) is now signed into AOL(R) Instant Messenger (TM) in 2
 locations. To sign off the other location(s), reply to this message with
 the number 1. Click <a
 href="http://www.aim.com/password/routing.adp">here</a> for more
 information., , 2'''

 Instead, in Pidgin 2.6.6, I get the following:

 '''Purple::Account=HASH(0x203c794), SCREEN_NAME, SCREEN_NAME,
 Purple::Conversation=HASH(0x2fcb534), 13860024'''

 Note that instead of being passed the sender and the message content, the
 callback is called with the screen name of my account twice, and the last
 parameter containing flags is garbage.

 I tracked this down to Revision [18b85ae6..]
 [http://developer.pidgin.im/viewmtn/revision/info/18b85ae6ad8091af43d91826cf054e4569ba74aa].
 This changed the function purple_perl_sv_from_vargs in the Perl plugin
 code to take a va_list parameters (by value) instead of a *va_list
 parameter (by reference).  However, the purple_perl_sv_from_vargs is
 called in a loop, and it internally calls the macro va_arg to extract each
 parameter from the va_list.  The problem is, va_arg modifies the va_list,
 but when the va_list is passed by value rather than by reference, then the
 caller to purple_perl_sv_from_vargs (perl_signal_cb) never sees the change
 to the va_list made by va_arg, and every parameter after the first one
 will be garbage.

 The description for the problematic revision indicates that it was made to
 fix a compiler warning - it does not indicate what the warning was, but
 the "fix" was obviously not correct (documentation for va_arg for both
 glibc and Microsoft implementations indicate that the ''value'' of the
 va_list itself is changed).  There may still be a way to fix the compiler
 warning, but this change should be reverted to make Perl plugins work
 again.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/11431>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list