develooper Front page | perl.perl5.porters | Postings from July 2009

[perl #67114] $@ being cleared by signal handlers

From:
Bram via RT
Date:
July 25, 2009 23:19
Subject:
[perl #67114] $@ being cleared by signal handlers
Message ID:
rt-3.6.HEAD-2466-1248547415-285.67114-14-0@perl.org
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> $@ is being cleared by signal handlers:
> 
>    perl -e '$SIG{INT}=sub{}; $@=5;kill INT => 0; die $@'
> 
> should give me 5, but "gives" me undef.
> 
> this means that it is virtually impossible to use signal handlers for
> profiling or asynchronous messaging, as almost no perl code will 
block
> signals between e.g. eval and checking for $@ (and I think no perl
>    code
> should have to do that).
> 
> There also seems to be no way to preserve $@ from perl as well.
> 
> I think perl should preserve $@, at least as long as the signal
>    handler
> does not die itself.
> 
> [Please do not change anything below this line]
> -----------------------------------------------------------------

Binary search:

----Program----
#!/usr/bin/perl -l

$SIG{INT}=sub{};
$@=5;
kill INT => $$;
print defined $@ ? $@ : "undef";

----Output of ...l/pZGlxCF/perl-5.7.0@8405/bin/perl----
5

----EOF ($?='0')----
----Output of ...l/pNJ3BPl/perl-5.7.0@8409/bin/perl----


----EOF ($?='0')----
Need a perl between 8405 and 8409
No patch available between 8405 and 8409


http://perl5.git.perl.org/perl.git/commit/
645f760415037835427326a63ea2418cd44ad456
Integrate perlio:author	Jarkko Hietaniemi <jhi@iki.fi>
	Fri, 12 Jan 2001 05:41:28 +0000 (05:41 +0000)
committer	Jarkko Hietaniemi <jhi@iki.fi>
	Fri, 12 Jan 2001 05:41:28 +0000 (05:41 +0000)
commit	645f760415037835427326a63ea2418cd44ad456
tree	71c4b24c2565df95fd48d130423254d2ed6f65dd	tree | snapshot
parent	075a4a2b17419f90b0888605cbb91ee4b236f645	commit | diff
parent	e86d18fb728c811dd6c2cb46964683c4547de3e7	commit | diff


Integrate perlio:

[  8408]
Remove variables that were used in experiments.

[  8407]
Catch die in %SIG handler and unblock the signal before re-dying.
This make Linux work _without_ sigsetjmp().
Turn off sigsetjmp() to see what else it does.
May need Configure probe for sigprocmask() if anything has sigaction()
but not sigprocmask().

p4raw-link: @8408 on //depot/perlio: 
e86d18fb728c811dd6c2cb46964683c4547de3e7
p4raw-link: @8407 on //depot/perlio: 
1b266415f383a85c93346bb15a7bdcac7f62eb77

p4raw-id: //depot/perl@8409



http://perl5.git.perl.org/perl.git/commit/
1b266415f383a85c93346bb15a7bdcac7f62eb77
author	Nick Ing-Simmons <nik@tiuk.ti.com>
	Thu, 11 Jan 2001 20:57:44 +0000 (20:57 +0000)
committer	Nick Ing-Simmons <nik@tiuk.ti.com>
	Thu, 11 Jan 2001 20:57:44 +0000 (20:57 +0000)
commit	1b266415f383a85c93346bb15a7bdcac7f62eb77
tree	0b4195c790a9a539f53fff4d87708a91de9c5e1d	tree | snapshot
parent	4bfee161f7a97900585aa2d88dc2e41ec655cbfb	commit | diff

Catch die in %SIG handler and unblock the signal before re-dying.
This make Linux work _without_ sigsetjmp().
Turn off sigsetjmp() to see what else it does.
May need Configure probe for sigprocmask() if anything has sigaction()
but not sigprocmask().

p4raw-id: //depot/perlio@8407



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About