blob: 902a5b074a2b549b36c36366eadda0d3f5cd041f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/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).
# At some point, the irssi devs fixed it so irssi no longer segfaults.
# irssi-1.4.4 doesn't, but 1.2.3 does.
use warnings;
use strict;
use Irssi qw/command command_bind/;
our $VERSION = "0.0";
our %IRSSI = (
authors => 'B. Watson',
contact => 'urchlay@slackware.uk or Urchlay on Libera ##slackware',
name => 'selfunload',
description => 'script that makes old irssi versions segfault',
license => 'WTFPL',
url => 'https://slackware.uk/~urchlay/repos/misc-scripts/plain/termbin',
);
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");
|