beluchin has asked for the wisdom of the Perl Monks concerning the following question:

(this question was originally posted on stackoverflow: http://stackoverflow.com/questions/5560866/perl-5-10-0-signal-handler-issue)

Interrupting the program below with Ctrl + C causes a "Segmentation fault" with perl 5.10.0. It works correctly with perl 5.8.8. Any idea why?

#!/usr/bin/perl # just changing the shebang line to use perl 5.10.0 causes # it to seg fault when interrupted with Ctrl + C use strict; use warnings; $SIG{INT}=\&clean; sub clean { print 'caught'; } sleep 10;

The perl 5.10 version is:

$ perl5.10.0 -v This is perl, v5.10.0 built for i686-linux-thread-multi (with 3 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Binary build 1002 [283697] provided by ActiveState http://www.ActiveSt +ate.com Built Jan 10 2008 07:35:18 ...

The linux distribution:

$ cat /proc/version Linux version 2.6.18-128.7.1.el5 (mockbuild@hs20-bc2-3.build.redhat.co +m) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Aug 19 04: +00:49 EDT 2009

Thanks

Replies are listed 'Best First'.
Re: Signal Handler Issue with Perl 5.10.0?
by JavaFan (Canon) on Apr 06, 2011 at 10:46 UTC
    If such a program causes a segfault, it's likely to be a bug. But since 5.10.0, there have been 1 major, and 4 minor releases, and a lot of development work for the next major version.

    Cut you check whether it still segfaults against 5.12.3 and blead? If it doesn't, the bug has been fixed, and upgrading your perl solves it. If it still isn't fixed, file a bug report, and it may get fixed in 5.14.1 (or if you are really lucky, in 5.14.0).

Re: Signal Handler Issue with Perl 5.10.0?
by wind (Priest) on Apr 06, 2011 at 03:10 UTC

    No such behavior on v5.10.0 built for i686-linux

    $ perl clean.pl caught$