Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Signal Handling Problem Posted by x00suman on 24 Feb 2004 at 2:22 AM
Hi All.
I think perl's Signal Handling has a bug.

I tried this
$SIG{INT} = \&Ctrl_C;

sub Ctrl_C
{
print "......\n";
$SIG{INT} = \&Ctrl_C;
$interrupted = 1;
...
}



but when I press Ctrl+C, it some times works, but perl crashes sometimes.

Windows reports as the preocess perl.exe has generated an error. Closing perl.exe ....

I use Win2K Professionl, SP3
Active Perl 5.6.1 Build 635

Can anyone tell me whether it is a Active Perl issue or Win2K issue.

thanks and Regards,
Sumanth Sharma
Report
Re: Signal Handling Problem Posted by Jonathan on 24 Feb 2004 at 3:49 AM
: I think perl's Signal Handling has a bug.
:
: I tried this
: $SIG{INT} = \&Ctrl_C;
:
: sub Ctrl_C
: {
: print "......\n";
: $SIG{INT} = \&Ctrl_C;
Why are you re-assigning the signal handler inside the handling sub?

: $interrupted = 1;
: ...
: }
:
: but when I press Ctrl+C, it some times works, but perl crashes
: sometimes.
:
: Windows reports as the preocess perl.exe has generated an error.
: Closing perl.exe ....
:
: I use Win2K Professionl, SP3
: Active Perl 5.6.1 Build 635
:
: Can anyone tell me whether it is a Active Perl issue or Win2K issue.
:
Depends how you define "issue". Windows ain't really into signals, which is part of the problem (interestingly, I've been looking into this area for Parrot internals of late, which is the runtime engine for Perl 6). I'm running ActivePerl 5.8, which doesn't exhibit the problem you showed. I know 5.8 also had additional fixes for things that previously could go wrong under Win32, so it may be a good idea for you to upgrade.

Before that, try removing the line I asked about earlier, 'cus your program works without it so far as I can see and there certainly are things that you probably shouldn't do in signal handlers.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Report
Re: Signal Handling Problem Posted by x00suman on 24 Feb 2004 at 4:01 AM
hi Jonathan,

I will have to re-assign, 'coz if a user again presses CTRL+C, the SIG{INT} would have got reset, and hence will not call my subroutine again. I have testted it. So re-assigning is required.

But thanks again, as you said, may be perl 5.8.3{latest} has got the fix for this.

I'll try with 5.8.xx and come back to you.

Thanks again.

: Depends how you define "issue". Windows ain't really into signals, which is part of the problem (interestingly, I've been looking into this area for Parrot internals of late, which is the runtime engine for Perl 6). I'm running ActivePerl 5.8, which doesn't exhibit the problem you showed. I know 5.8 also had additional fixes for things that previously could go wrong under Win32, so it may be a good idea for you to upgrade.
:
: Before that, try removing the line I asked about earlier, 'cus your program works without it so far as I can see and there certainly are things that you probably shouldn't do in signal handlers.
:
: Jonathan
:
: ###
: for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
: /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
:
:

Report
Re: Signal Handling Problem Posted by Jonathan on 24 Feb 2004 at 7:22 AM
Hi,

: I will have to re-assign, 'coz if a user again presses CTRL+C, the
: SIG{INT} would have got reset, and hence will not call my subroutine
: again. I have testted it. So re-assigning is required.
:
I'd disagree. Maybe you have to do that because 5.6.1 is buggy, but it should not need it to be reset; see the below test results.

On Windows, Perl 5.8:-
C:\Documents and Settings\Jonathan>type test.pl
$SIG{INT} = \&Ctrl_C;

while (1) { };

sub Ctrl_C
{
print "......\n";
}
C:\Documents and Settings\Jonathan>perl test.pl
......
......
......
......
......
......
......


On Linux, Perl 5.6.1:-
[jonathan@trinity jonathan]$ cat test.pl
$SIG{INT} = \&Ctrl_C;

while (1) { };

sub Ctrl_C
{
print "......\n";
}

[jonathan@trinity jonathan]$ perl test.pl
......
......
......
......
......


As you can see, I can press Ctrl+C many times without having to reset it.

: But thanks again, as you said, may be perl 5.8.3{latest} has got the
: fix for this.
:
: I'll try with 5.8.xx and come back to you.
:
Here's hoping. They certainly fixed some things in 5.8.xx; fork() for starters.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Report
Re: Signal Handling Problem, 5.6.1 bUGS Posted by x00suman on 24 Feb 2004 at 10:00 PM
Hi,

I will have to trust you. As you said I think perl 5.6.1 on windows has a bug. It gets reset, or may be the perl 5.6.1 PRD is like that. Anyways I cannot afford to switch to 5.6.1 on my office network, for we run regressions using 5.6.1.


But I have a request.
Can you tell me WHERE SHOULD I FILE A BUG ON PERL/.

I have another bug to report on perl's rename() function.

IF YOU ARE INTERESTED; I CAN GIVE YOU A SCRIPT TO RERPODUCE THE PERL'S RENAME PROBLEM!.




Report
Re: Signal Handling Problem, 5.6.1 bUGS Posted by Jonathan on 25 Feb 2004 at 3:37 AM
Hi,

: I will have to trust you. As you said I think perl 5.6.1 on windows
: has a bug. It gets reset, or may be the perl 5.6.1 PRD is like that.
: Anyways I cannot afford to switch to 5.6.1 on my office network, for
: we run regressions using 5.6.1.
:
Note that there is a 5.6.2 which does have some Win32 improvements. It may be worth checking out; see here:-
http://dev.perl.org/perl5/news/2003/perl-5.6.2.html

: But I have a request.
: Can you tell me WHERE SHOULD I FILE A BUG ON PERL/.
:
: I have another bug to report on perl's rename() function.
:
Check here:-
http://rt.perl.org/perlbug/

: IF YOU ARE INTERESTED; I CAN GIVE YOU A SCRIPT TO RERPODUCE THE
: PERL'S RENAME PROBLEM!.
:
Yes, please - I'd be interested to see it.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Report
Re: Signal Handling Problem, 5.6.1 bUGS Posted by x00suman on 25 Feb 2004 at 6:13 AM
: : IF YOU ARE INTERESTED; I CAN GIVE YOU A SCRIPT TO RERPODUCE THE
: : PERL'S RENAME PROBLEM!.
: :
: Yes, please - I'd be interested to see it.
:
: Jonathan

---- I have posted the information as a new message.
Please check it. [ Bug in Perl rename() function ]

Again, thanks for the valuable piece of information

Sumanth Sharma.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.