develooper Front page | perl.perl5.porters | Postings from December 2005

[perl #37482] FreeBSD exec Hanging in $SIG{__WARN__} for exec Warning

From:
Steve Peters via RT
Date:
December 27, 2005 05:51
Subject:
[perl #37482] FreeBSD exec Hanging in $SIG{__WARN__} for exec Warning
> [smylers@stripey.com - Wed Oct 19 08:16:01 2005]:
> 
> This is a bug report for perl from Smylers <Smylers@stripey.com>,
> generated with the help of perlbug 1.35 running under perl v5.8.7.
> 
> 
> -----------------------------------------------------------------
> I have a $SIG{__WARN__} handler which hangs seemlingly forever in
>    these
> circumstances:
> 
> * The handler attempts an exec (I was trying to pipe the warning to
>   another process, in which case it is calling close that hangs, but
>   calling system also hangs).
> 
> * The warning handler is being called because an exec has just failed,
>   such as by trying to call system on a non-existent file.
> 
> * Running on FreeBSD.  The test-case that hangs on FreeBSD runs fine
>    on
>   Linux, performing the second system call and continuing on as
>   expected.  In both cases I was using perl5.8.7.
> 
> When the second exec hangs even pressing Ctrl+C abort the script;
> however pressing Ctrl+Z and using kill does.
> 
> Here's a small test-case illustrating the problem -- on FreeBSD it
> doesn't terminate:
> 
> #! /usr/bin/perl
> 
> use warnings;
> 
> $SIG{__WARN__} = sub
> {
>   print "print:  @_";
>   system 'echo', 'system:', @_;
> };
> 
> system 'non-existent_command';
> __END__
> 

Are you getting this problem on FreeBSD 4.10 only?  Have you run into 
this problem on other FreeBSDs?  

I tried it on FreeBSD 6.0 and it worked fine, so, it seems like this is 
a FreeBSD bug.  If that's the case, though, it should be documented.



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About