On Sat, Feb 09, 2013 at 03:07:12PM +0200, Niko Tyni wrote:

> I'm attaching a slightly more compact version of the test script at
> [perl #116621]. It consistently fails for me on sid/amd64 (perl 5.14.2)
> but succeeds on squeeze (perl 5.10.1).

Here's another testcase that triggers the bug with
a custom SIGUSR1 handler. So it's not limited to
just SIGCHLD.
-- 
Niko Tyni   nt...@debian.org
#!/usr/bin/perl -w
use strict;

my $MAX = 100;
use Time::HiRes q/usleep/;

$SIG{USR1} = sub { 1 };

if (my $kid = open(my $p, "|-")) { # parent
    if (!fork) { # coprocess to send signals
        close $p;
        while (1) {
            kill USR1 => $kid;
            usleep(rand()*30000);
        }
        exit 0;
    } 
    my $i=0;
    while ($i++ < $MAX) {
        syswrite($p, "y\n", 2);
        usleep(rand()*30000);
    }
    exit 0;
} else { # kid
    my $j=0;
    $j++ while <>;
    print $j == $MAX ? "ok # reached $j tries\n" :
                       "not ok # exited after $j tries\n";

}

Reply via email to