Skip Menu |
 

This queue is for tickets about the File-Fetch CPAN distribution.

Report information
The Basics
Id: 87380
Status: open
Priority: 0/
Queue: File-Fetch

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: SIG CHLD IGNORE
Download (untitled) / with headers
text/plain 427b
I wonder why File::Fetch uses local $SIG{CHLD} = 'IGNORE'; and does not even advertise that. 1. default signal action is IGNORE 2. If main program has own SIG CHLD handler, this breaking it. 3. If main program has own SIG CHLD handler and fails because open("|$ftp -n") delivers SIGCHLD, main program is broken, not this module. (some other modules like Cwd execute external command and main program should handle it right)
Download (untitled) / with headers
text/plain 681b
On Sun Jul 28 07:17:03 2013, vsespb wrote: Show quoted text
> I wonder why File::Fetch uses > > local $SIG{CHLD} = 'IGNORE'; > > and does not even advertise that. > > 1. default signal action is IGNORE > 2. If main program has own SIG CHLD handler, this breaking it. > 3. If main program has own SIG CHLD handler and fails because > open("|$ftp -n") > delivers SIGCHLD, main program is broken, not this module. (some other > modules like Cwd execute external command and main program should > handle it right)
The local will localise the scope of this to the enclosing block. Presumably it is this way to counter the type of behaviour where people do not localise their SIG handlers. Cheers.
From: victor [...] vsespb.ru
Download (untitled) / with headers
text/plain 1.5k
My point, this looks like a workaround for case when main program has SIG CHLD HANDLER like this: $SIG{CHLD} = sub { die; } # intendent behaviour - die when any of child process terminate such program will break after open("|$ftp -n") finished (because SIG CHILD will arrive). correct main program handler should look like this: my %children; ... # collect pids into %children $SIG{CHLD} = sub { die if $children{$$}; } # only terminate if registered child die Problem, that this workaround ( local $SIG{CHLD} = 'IGNORE') (for above problem in main program) actually will break the main program if it is correct. $SIG{CHLD} = sub { die if $children{$$}; } won't work during scope of local $SIG{CHLD} = 'IGNORE'; i.e. there is race condition - main program logic to terminate if child dies, is not executed if child die during ftp transfer. On Fri Aug 09 00:19:07 2013, BINGOS wrote: Show quoted text
> On Sun Jul 28 07:17:03 2013, vsespb wrote:
> > I wonder why File::Fetch uses > > > > local $SIG{CHLD} = 'IGNORE'; > > > > and does not even advertise that. > > > > 1. default signal action is IGNORE > > 2. If main program has own SIG CHLD handler, this breaking it. > > 3. If main program has own SIG CHLD handler and fails because > > open("|$ftp -n") > > delivers SIGCHLD, main program is broken, not this module. (some > > other > > modules like Cwd execute external command and main program should > > handle it right)
> > The local will localise the scope of this to the enclosing block. > > Presumably it is this way to counter the type of behaviour where > people do not localise their SIG handlers. > > Cheers.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.