Re: How to kill perl?
by Aristotle (Chancellor) on Nov 04, 2005 at 21:59 UTC
|
$ perl -le'/(??{s!!!})/'
Segmentation fault
(I like the way it kind of looks like someone’s yelling “what the hell?!” at perl.)
Makeshifts last the longest. | [reply] |
|
| [reply] |
Re: How to kill perl?
by diotalevi (Canon) on Nov 04, 2005 at 18:21 UTC
|
unpack "P", ~0Why doesn't unpack "P", 0 dump? I expected it to and this confused me. | [reply] [d/l] [select] |
|
if (!ptr) {
(void)SvOK_off(sv);
return;
}
In other words, unpack("P", 0) just returns an undefined SV. Since C code often uses null pointers in the same way that Perl code uses undef, I think this is more useful than crashing. :-)
| [reply] [d/l] |
Re: How to kill perl?
by samtregar (Abbot) on Nov 04, 2005 at 18:26 UTC
|
| [reply] [d/l] |
|
| [reply] |
Re: How to kill perl?
by EvanCarroll (Chaplain) on Nov 04, 2005 at 19:13 UTC
|
| [reply] [d/l] [select] |
|
So, it turns out that your map/reverse bug is just one of a family of crash bugs, e.g:
perl -e "map chomp(+()), ('')x10000;"
perl -e "map chown(+()), ('')x10000;"
perl -e "map warn(+()), ('')x100;"
Though they're all fixed now! | [reply] [d/l] |
|
Not all of them are fixed, the top two tested negative, with Perl 5.8.7; however, the bottom one produced this.
perl -e "map warn(+()), ('')x100;"
...
...
Warning: something's wrong at -e line 1.
Warning: something's wrong at -e line 1.
Warning: something's wrong at -e line 1.
Warning: something's wrong at -e line 1.
Warning: something's wrong at -e line 1.
Warning: something's wrong at -e line 1.
Warning: something's wrong at -e line 1.
Segmentation fault
UPDATE:
You are correct by increasing the number to 100_000, the top two crash as well.
Evan Carroll www.EvanCarroll.com
| [reply] [d/l] [select] |
|
|
|
My site has a nice one with reverse and sort perlbugs
That is nice. Do you have any idea why it happens? Is it in the bug database?
Update: Looks like you don't need the second reverse, or even the <>; the following crashes both bleadperl and 5.8.6 for me:
perl -e 'map print(reverse), ("")x68'
| [reply] [d/l] |
|
perl -e '@a=(0,1); map {@a=() if $_; $_} @a'
| [reply] [d/l] |
Re: How to kill perl?
by ambrus (Abbot) on Nov 04, 2005 at 21:44 UTC
|
| [reply] [d/l] |
Re: How to kill perl?
by tirwhan (Abbot) on Nov 04, 2005 at 19:30 UTC
|
perl -MIO::Prompt -e'while(prompt){1}'
but that's using a module, so maybe it's cheating ;-)?
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan
| [reply] [d/l] |
Re: How to kill perl?
by Perl Mouse (Chaplain) on Nov 07, 2005 at 10:16 UTC
|
$ perl -e '/(?{<})/'
panic: top_env
If you swap the less then sign, it's just a syntax error:
$ perl -e '/(?{>})/'
syntax error at (re_eval 1) line 1, near ">"
Compilation failed in regexp at -e line 1.
(Reason: anything that might be the start of a quoted construct inside (?{}), but isn't followed by one panics perl. (?{'}), (?{"}), (?{`}), (?{<}), (?{/}), (?{?}), (?{q}), (?{m}) and (?{s}) all panic perl. Other single charactes seem to do ok (although I didn't check all of them).
| [reply] [d/l] [select] |
|
| [reply] |
|
| [reply] |
Re: How to kill perl?
by sauoq (Abbot) on Nov 04, 2005 at 23:34 UTC
|
$ echo -e 'foo\n' | perl -e'print sort{*a=$b,0} <>'
*** glibc detected *** malloc(): memory corruption: 0x0812dcdc ***
Aborted
-sauoq
"My two cents aren't worth a dime.";
| [reply] [d/l] |
|
I could claim that gnu malloc(3) was able to prevent
the segfault. Here it is choosing a graceful abort
to the crash.
$ export MALLOC_CHECK_=2
$ perl -e 'print sort{*a=$b,0} <>'
a
b
Aborted
| [reply] [d/l] |
Re: How to kill perl?
by sauoq (Abbot) on Nov 04, 2005 at 23:56 UTC
|
Okay, here's one I just found...
$ perl -e'@a=(1,1);map{sort{@a=()}@a}@a'
Segmentation fault
Update: Err... but that's on 5.8.0. It seems to be okay on 5.8.7. Darn.
-sauoq
"My two cents aren't worth a dime.";
| [reply] [d/l] |
Re: How to kill perl?
by Steve_p (Priest) on Nov 05, 2005 at 19:25 UTC
|
perl -e 'undef %:: or die'
I'm testing a fix to this in bleadperl and it appears to have it fixed. Should be available later today. By the way...
perl -e 'undef %:: or warn'
was equally broken. | [reply] [d/l] [select] |
|
perl -e 'undef %::; sub{}->()'
crashes too. Lots of thing crash when you've totalled the defstash! But perhaps that just indicates a pervasive assumption, which really needs to be fixed in lots of different places.
See also bug 32401.
PS. Getting a bit more targeted:
perl -e 'delete $::{"@"}; warn' ;# crashes
perl -e 'delete $::{"@"}; sub{}->()' ;# doesn't crash
perl -e 'delete $::{"_"}; warn' ;# doesn't crash
perl -e 'delete $::{"_"}; sub{}->()' ;# crashes
I suppose that wiping out important global variables oughtn't to be allowed, really.
PPS. Let's see what the p5p hive mind thinks. | [reply] [d/l] [select] |
|
Ugh! Spoke too soon. My fix kills some of the more exotic functionality of die(). Well, at least I know I'm on the right track.
| [reply] |
Re: How to kill perl?
by Steve_p (Priest) on Nov 05, 2005 at 02:40 UTC
|
I closed a few perlbugs opened by people that ran something that amounted to perl -u, which is supposed to dump core on purpose.
| [reply] [d/l] |
Re: How to kill perl?
by duckyd (Hermit) on Nov 08, 2005 at 00:28 UTC
|
perl -e 'END{%::=()}'
| [reply] [d/l] |
|
These stash-nuking bugs are now fixed in blead. Yay!
(The fix was originally written in April 2001 by Benjamin Sugars, but was only applied today.)
| [reply] |
Re: How to kill perl?
by mikeock (Hermit) on Nov 04, 2005 at 21:39 UTC
|
Wow, There are some really interesting ways to acomplish this! Any one have any others?
| [reply] |
|
perl -e'sub f{undef &f} ()=sort f 1,2'
perl -e'sub f{goto sub{1}} ()=sort f 1,2'
perl -e'@a=(1..10);@a=sort{@a=(1);0}@a'
| [reply] [d/l] |
|
| [reply] [d/l] |
|
Re: How to kill perl?
by Dominus (Parson) on Nov 06, 2005 at 23:34 UTC
|
Maybe this isn't what you wanted, but my favorite is kill 6 => $$.
| [reply] |
Re: How to kill perl?
by monarch (Priest) on Nov 07, 2005 at 01:05 UTC
|
Whilst it doesn't cause a core dump, another method for bailing out of perl quickly, is to use the POSIX module.. use POSIX qw(_exit);
POSIX::_exit( 0 ); # abort ungracefully (and quickly!)
When perl dies it usually appears to spend lots of time closing file handles. For a forked server that has lots of sockets open this could take some time, so why not let the OS deal with the messy issues and use POSIX::_exit(). | [reply] [d/l] [select] |
Re: How to kill perl?
by Anonymous Monk on Nov 04, 2005 at 21:48 UTC
|
How to kill perl?
die perl, die
;-) | [reply] |
|
| [reply] |
Re: How to kill perl?
by whio (Beadle) on May 07, 2006 at 04:16 UTC
|
perl -we s//*_=0/e
perl -e s//*_=0/e
This one is interesting mostly because $^W has an unexpected effect. (some versions of perl don't crash if -w is used.)
| [reply] [d/l] [select] |
Re: How to kill perl?
by Dominus (Parson) on Aug 20, 2007 at 14:21 UTC
|
| [reply] |
|
| [reply] |
Re: How to kill perl?
by poolpi (Hermit) on Jan 11, 2008 at 09:33 UTC
|
# This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
# Linux 2.6.18-4-686
#!/usr/bin/perl
use strict;
use warnings;
my $c;
my $x =~ /(?{local $c})/;
Die with: panic: top_env
PooLpi | [reply] [d/l] |
Re: How to kill perl?
by EvanCarroll (Chaplain) on Feb 14, 2006 at 04:43 UTC
|
| [reply] [d/l] |
|
What version of perl does that kill? On what platform? (I can't get it to kill 5.8.6 or 5.9.3, on the Mac.)
| [reply] |