Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 1034 - xchat crashes when loading perl plugins
Summary: xchat crashes when loading perl plugins
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gabriele Giorgetti
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-09 18:48 UTC by Andrew Wils
Modified: 2003-02-04 19:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Wils 2002-03-09 18:48:05 UTC
xchat (the ebuild 1.8.7, also version 1.8.8 i downloaded myself) crashes
immediately when I try to load a perl plugin (segmentation fault).
System: Pentium III, gentoo (--world update done today), linux 2.4.17
Perl v5.6.1.

Running strace says something about:
stat64("/usr/lib/perl5/site_perl/5.6.0", {st_mode=S_IFDIR|0755,
st_size=23, ...}) = 0
and that directory doesn't contain much (only AbiWord). But I don't 
know for certain if that's the problem or not.
Comment 1 Bruce A. Locke (RETIRED) gentoo-dev 2002-03-10 05:32:50 UTC
Unable to reproduce here.

Please do the following:
emerge rsync ; emerge perl ; emerge xchat

If it still does it please try using ltrace instead of strace and if possible
attach the script causing the error.

Comment 2 Andrew Wils 2002-03-20 02:50:52 UTC
remerging xchat and perl didn't solve the problem. What's more, xchat instantly
segfaults when I use ltrace

...
...
gtk_marshal_NONE__POINTER_POINTER(0x08229cd8, 0x4069a0ac, 0, 0xbfffe38c,
0x407535f4) = 0x08226b60
<... gtk_widget_destroy resumed> )                = 0x081e5678
breakpointed at 0x40682ea9 (?)
--- SIGSEGV (Segmentation fault) ---

Recently I've discovered the xchat on my debian system at work crashes on perl
scripts as well (and other collegues' xchats work just fine with the same
script), so I guess it's not gentoo related. Thanks anyway.
Comment 3 Troy Dack 2002-04-24 04:46:34 UTC
Attached below is the output from ltrace & the perl script that I tried to load.

Here's what's on my system:

gentoo troy # qpkg -I xchat && qpkg -I perl
net-irc/xchat-1.8.8-r1 *
dev-perl/gtk-perl-0.7008 *
dev-perl/libwww-perl-5.50 *
dev-perl/libxml-perl-0.07 *
sys-devel/perl-5.6.1-r3 *
Comment 4 Troy Dack 2002-04-24 04:56:22 UTC
Since bugzilla won't take my attachment from any one of three browsers I'm a bit
stuffed!

The ltrace output can be found @ http://gentoo.tkdack.com/xchat.ltrace.bz2

Here's the perl script since it isn't *that* big (the ltrace to 200K bzip'd!)

# --- begin  Autoaway11.pl ---
!/usr/bin/perl -w

#
# AutoAway 1.1 by think @ EFnet, (gisle@skald.no).
# Do whatever you want with it.
#
# Usage: Edit the variables, and make sure the dir ~/.xchat
# exists and that your user has write permissions to it.
#
# Commands:
#
/awaymsg <message> - Sets your default away-reason
#
/awaynick <nick> - Sets your default away-nick (leave blank if you don't want it
to change your nick)
#
/awaytimer <integer> - Sets how many idle minutes to wait before going to away mode.
#
/awaylog <ON/OFF> - Logs all messages sent to you, and all channel-messages
containing your nick (while away).
#
/awaystatus - Display the current status
#

#
# Edit the variables below
#

$defaultawaynick = "I_AM_AWAY";		# Those variables will be saved in a file the
$defaulttimer = "30";			# first time you run the script. After that you
$defaultmsg = "Gone fishin'";		# can configure it using the commands above.
$defaultlog = "ON";			#

#
# Do not edit below this line unless you know some perl.
#

IRC::register("AutoAway", "1.1", "", "");
IRC::print "\0035:: AutoAway 1.1 by think loaded ::\003 \n";
IRC::add_command_handler("awaymsg", "set_awaymsg");
IRC::add_command_handler("awaynick", "set_awaynick");
IRC::add_command_handler("awaytimer", "set_awaytimer");
IRC::add_command_handler("awaylog", "toggle_awaylog"); 
IRC::add_command_handler("awaystatus", "show_awaystatus");
IRC::add_print_handler("Your Message", "send_msg");
IRC::add_timeout_handler(60000, "timer"); 
IRC::add_message_handler("PRIVMSG", msg_rcv);

my($idletime) = 0;
my($status) = "BACK";
my($loglines) = 0;

foreach $line (split "\n", `cat $ENV{HOME}/.xchat/autoaway.cfg`) {
	my($var0, $value)=(split "=", $line);
	$VAR{$var0}=$value;

	if(!$VAR{AWAYNICK}) { $VAR{AWAYNICK} = $defaultawaynick }
        if(!$VAR{AWAYMSG}) { $VAR{AWAYMSG} = $defaultmsg }
        if(!$VAR{AWAYTIMER}) { $VAR{AWAYTIMER} = $defaultawaytimer }
	if(!$VAR{AWAYLOG}) { $VAR{AWAYLOG} = $awaylog }

	$VAR{AWAYNICK} =~ s/"/\^/g;
}

sub set_awaymsg {
	my($msgvalue) = shift(@_);
	$VAR{AWAYMSG} = $msgvalue;

	$db = `cat $ENV{HOME}/.xchat/autoaway.cfg`;
	open(DB, ">$ENV{HOME}/.xchat/autoaway.cfg");
	foreach $line (split "\n", $db) {
		my($var, $value)=(split "=", $line);
		print DB "$var=$value\n" if ($var ne "AWAYMSG");
	}
	print DB "AWAYMSG=$msgvalue\n";
	close(DB);
	IRC::print "\0035:: New awaymsg set ($msgvalue) ::\003 \n";
	return 1;
}

sub set_awaynick {
	my($nickvalue) = shift(@_);
	$nickvalue = "\@" if ($nickvalue eq "");
	$snick = "None" if ($nickvalue eq "\@");
	$snick = $nickvalue if ($nickvalue ne "\@");
	$nickvalue =~ s/\^/"/g;
	$VAR{AWAYNICK} = $nickvalue;

        $db = `cat $ENV{HOME}/.xchat/autoaway.cfg`;
	open(DB, ">$ENV{HOME}/.xchat/autoaway.cfg");
        foreach $line (split "\n", $db) {
                my($var, $value)=(split "=", $line);
                print DB "$var=$value\n" if ($var ne "AWAYNICK");
        }
	print DB "AWAYNICK=$nickvalue\n";
	close(DB);
	IRC::print "\0035:: New awaynick set ($snick) ::\003 \n";
	return 1;
}

sub set_awaytimer {
	my($timervalue) = shift(@_);
	$VAR{AWAYTIMER} = $timervalue;

        $db = `cat $ENV{HOME}/.xchat/autoaway.cfg`;
	open(DB, ">$ENV{HOME}/.xchat/autoaway.cfg");
        foreach $line (split "\n", $db) {
                my($var, $value)=(split "=", $line);
                print DB "$var=$value\n" if ($var ne "AWAYTIMER");
        }
	print DB "AWAYTIMER=$timervalue\n";
	close(DB);
	IRC::print "\0035:: New awaytimer set ($timervalue) ::\003 \n";
	return 1;
}

sub toggle_awaylog {
        my($logvalue) = shift(@_);

	$logvalue =~ s/o/O/;
	$logvalue =~ s/n/N/;
	$logvalue =~ s/f/F/g;

	if(($logvalue ne "ON") && ($logvalue ne "OFF")) {
		IRC::print "\0035:: Illegal value. ::\003 \n";
		return 0;
	}

        $VAR{AWAYLOG} = $logvalue;

        $db = `cat $ENV{HOME}/.xchat/autoaway.cfg`;
        open(DB, ">$ENV{HOME}/.xchat/autoaway.cfg");
        foreach $line (split "\n", $db) {
                my($var, $value)=(split "=", $line);
                print DB "$var=$value\n" if ($var ne "AWAYLOG");
        }
	print DB "AWAYLOG=$logvalue\n";
        close(DB);
        IRC::print "\0035:: Awaylog now turned $logvalue. ::\003 \n";
        return 1;
}

sub send_msg {
	$idletime = 0;
	&set_back if ($status eq "AWAY");
}

sub set_away {
	@servers = IRC::server_list();
	foreach (@servers) {
		$NICK{$_} = IRC::get_info(1);
		IRC::command_with_server("/away $VAR{AWAYMSG}", "$_");
		if($VAR{AWAYNICK} ne "\@") { IRC::command_with_server("/nick $VAR{AWAYNICK}", "$_") }
	}
	$status = "AWAY";
	open(LOG, ">$ENV{HOME}/xchat-away.log") if ($VAR{AWAYLOG} eq "ON");
	IRC::print "\0035:: Setting away on server(s)... ::\003 \n";
}

sub set_back {
	if($status eq "AWAY") {
		@servers = IRC::server_list();
		foreach (@servers) {
			IRC::command_with_server("/away", "$_");
			if($VAR{AWAYNICK} ne "\@") { IRC::command_with_server("/nick $NICK{$_}", "$_") }
		}
	$status = "BACK";
        close(LOG);
	IRC::print "\0035:: Setting back on server(s)... ::\003 \n";
        IRC::print "\0035:: Logged $loglines messages ::\003 \n";
	}
}

sub timer {
	$idletime = $idletime + 1;
	if(($idletime) > $VAR{AWAYTIMER}) {
		&set_away if($status eq "BACK");
	}
	IRC::add_timeout_handler(60000, "timer");
}

sub show_awaystatus {
	$CS = "Not away" if($status eq "BACK");
	$CS = "Away" if($status eq "AWAY");
	$snick = "None" if ($VAR{AWAYNICK} eq "\@");

	IRC::print "\0036:: Current status: ::\003 \n";
	IRC::print "\0035:: Away-nick: $snick ::\003 \n";
	IRC::print "\0035:: Away-reason: $VAR{AWAYMSG} ::\003 \n";
	IRC::print "\0035:: Away-timer: $VAR{AWAYTIMER} mins. ::\003 \n";
	IRC::print "\0035:: You are currently marked as: $CS. ::\003 \n";
	IRC::print "\0035:: Current idle time: $idletime min(s). ::\003 \n";
        IRC::print "\0035:: Logging: $VAR{AWAYLOG} ::\003 \n"; 
	return 1;
}

sub msg_rcv {
	if($status ne "AWAY") {
		return 0;
	}

	my($line) = shift(@_);
	$line =~ m/\:(.*?)\!(.*?)\sPRIVMSG\s(.*?)\s\:(.*)?/;
	my($msgnick) = $1;
	my($msgsender) = $2;
	my($msgloc) = $3;
	my($msgline) = $4;
	my($currentnick) = IRC::get_info(1); 
	if($msgloc eq $currentnick) {
		IRC::command("/notice $msgnick I'm currently away \( $VAR{AWAYMSG} \)");
		if($VAR{AWAYLOG} eq "ON") {
			print LOG "<$msgnick> $msgline\n";
			$loglines = $loglines + 1;
		}
	} elsif (index($msgline, $currentnick) != -1) {
		if($VAR{AWAYLOG} eq "ON") {
			print LOG "$msgloc: <$msgnick> $msgline\n";
			$loglines = $loglines + 1;
		}
	}
	return 0;
}

# EOF
# --- end  Autoaway11.pl ---
Comment 5 Troy Dack 2002-04-28 06:57:56 UTC
For me this only seems to happen when xchat is running in a KDE3 session.

I tested xchat in a Gnome session and it worked fine.

I haven't got KDE2 on my system any more, but I do have Fluxbox and
Enlightenment so I'll test it in those WM's and see what I can find out.
Comment 6 Troy Dack 2002-04-29 08:42:28 UTC
OK, more testing: 
 
I built xchat initiall with *all* USE flags turned off (even X), naturally this only built 
xchat-text. 
 
I progressivly turned on the USE flags that are in the ebuild and had success with: 
gtk mmx python perl ssl nls ipv6 
 
Adding  gnome  to the USE flags causes a crash when loading a perl script while running in KDE. 
 
Having only USE="gnome perl gtk" also caused a crash. 
 
In the ebuild configuring it so that if USE="gnome" onle --enable-gnome (and no --enable-pixbuf) 
is used resulted in a crash as well. 
 
So it seems like there is something to do with the KDE/Gnome app relation that is causing 
problems. 
 
Short workaround: 
 
export USE="-gnome"; emerge xchat 
 
 
Comment 7 Troy Dack 2002-04-29 09:07:26 UTC
 portage (1.9.3/4)doesn't seem to be paying any attention to USE flags passed on the command line 
(either export USE="xxx"; emerge  or USE="xx" emerge ) 
 
So modify /etc/make.conf, add -gnome to USE= , emerge xchat, modify make.conf 
 
Comment 8 Tod M. Neidt (RETIRED) gentoo-dev 2002-04-29 09:13:39 UTC
Hi Troy!

Good information. I appreciate the initiative you have taken in trouble shooting
this bug.  I added you to the CC list (hope you don't mind) so you would get
this message.
Comment 9 Tod M. Neidt (RETIRED) gentoo-dev 2002-04-29 09:39:13 UTC
> portage (1.9.3/4)doesn't seem to be paying any attention to USE flags passed
on >the command line 
>(either export USE="xxx"; emerge  or USE="xx" emerge ) 
> 
>So modify /etc/make.conf, add -gnome to USE= , emerge xchat, modify make.conf 

FYI:

You can get the this to work by modifying the default USE_ORDER in your
/etc/make.conf to overide /etc/make.globals.

For example, add the line 

USE_ORDER="env:conf:defaults" 

to /etc/make.conf ( I think the 'auto' option is the one causing problems)
Comment 10 Seemant Kulleen (RETIRED) gentoo-dev 2002-06-29 00:33:08 UTC
I dunno, if this is still an issue.  Gabriele, can you investigate, please?
Comment 11 Spider (RETIRED) gentoo-dev 2002-09-29 13:33:06 UTC
please check with 1.8.10 if this still is an issue.
Comment 12 Andrew Wils 2002-10-25 13:09:22 UTC
seems to work for me again! thanks for investigating