diff options
author | B. Watson <yalhcru@gmail.com> | 2018-08-28 23:15:23 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2018-08-28 23:15:23 -0400 |
commit | 8cc4443ad7d967581d50815b288e021758f52cdb (patch) | |
tree | e7764015484c9442b76462f775cf51942d97a7d2 | |
parent | b343013ee5127ff20b56cdffbebacdac06df0b11 (diff) | |
download | misc-scripts-8cc4443ad7d967581d50815b288e021758f52cdb.tar.gz |
selfunload.pl: test case for a segfault bug in irssi
-rw-r--r-- | selfunload.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/selfunload.pl b/selfunload.pl new file mode 100644 index 0000000..2b67c81 --- /dev/null +++ b/selfunload.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl + +# A script that tries to unload itself while it's running. This causes +# irssi to segfault. It isn't a surprise that a script can't safely +# unload itself, but it sort of is a surprise that irssi segfaults. +# I'd expect it to give an error message and not segfault. + +# Save this file as: ~/.irssi/scripts/selfunload.pl +# Load it in irssi with: /script load selfunload +# Execute with: /selfunload + +# gdb backtrace of the core file it produces: +# #0 0x00002b24a04a4c12 in free () from /lib64/libc.so.6 +# #1 0x00000000004a05d5 in perl_script_unload () +# (no, I don't have debug symbols in my irssi binary, sorry). + +use warnings; +use strict; + +use Irssi qw/command command_bind/; + +our $VERSION = "0.0"; +our %IRSSI = ( + authors => 'B. Watson', + contact => 'yalhcru@gmail.com or Urchlay on FreeNode ##slackware', + name => 'selfunload', + description => 'script that makes irssi segfault' + license => 'WTFPL', +); + +sub selfunload { + # Attempt to unload myself while I'm running: + command("/script unload selfunload"); + + # The next command never executes, we've already segfaulted irssi! + command("/echo unloaded"); +} + +command_bind("selfunload", "selfunload"); |