Curious. I don't see that on my Ubuntu desktop; I see:
[pid 10788] read(3, "", 8192) = 0
[pid 10788] close(3) = 0
[pid 10788] read(0, "slopslopslop\n", 8192) = 13
[pid 10788] read(0, "", 8192) = 0
[pid 10788] write(1, "got `slopslopslop\n'", 19) = 19
[pid 10789] <... read resumed> "got `slopslopslop\n'", 8192) = 19
[pid 10788] +++ exited with 0 +++
[pid 10787] <... read resumed> 0xd382c0, 8192) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
While I wait for perlbrew to build me a Perl 5.18.2, try this and tell me if it works:
diff --git a/lib/Scriptalicious.pm b/lib/Scriptalicious.pm
index a17f91e..c72f40a 100644
--- a/lib/Scriptalicious.pm
+++ b/lib/Scriptalicious.pm
@@ -951,8 +951,10 @@ sub setup_fds {
if ( my $pid = fork ) {
my $rw = ($mode eq ">" ? "W" : "R");
+ my $wr = ($mode eq ">" ? "R" : "W");
open($fd, "$mode&FD${fnum}_$rw")
or barf "failed to re-open fd $fnum $mode CODE; $!";
+ close(\*{"FD${fnum}_$wr"})
} elsif ( !defined $pid ) {
barf "fork failed; $!";
} else {
PRs against github.com/samv/scriptalicious (heh, so old the repo name is lower case) will be returned in favor by CPAN releases.
Cheers,
Sam
On Fri Mar 28 06:20:07 2014, ppisar wrote:
Show quoted text> Dne So 08.čen.2013 16:54:40, GREGOA napsal(a):
> > This bug has been forwarded from
http://bugs.debian.org/711614
> >
> > -->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->
> >
> > Source: libscriptalicious-perl
> > Version: 1.16-1
> > Severity: important
> > User: debian-perl@lists.debian.org
> > Usertags: perl-5.18-transition
> > Tags: sid jessie
> >
> > This package FTBFS with perl 5.18 from experimental (in a clean
> > sbuild
> > session):
> >
> > t/03-yaml.t .......... ok
> > make[1]: *** wait: No child processes. Stop.
> > make[1]: *** Waiting for unfinished jobs....
> > make[1]: *** wait: No child processes. Stop.
> > make: *** wait: No child processes. Stop.
> > make: *** Waiting for unfinished jobs....
> > make: *** wait: No child processes. Stop.
> > Build killed with signal TERM after 150 minutes of inactivity
> >
> >
>
> Minimal reproducer:
>
> $ tail main.pl helper.pl
> ==> main.pl <==
> use Scriptalicious;
>
> my $output = capture(
> -in => sub { print "slopslopslop\n" },
> -out => sub {
> my $foo = <STDIN>; # comment this out to suppress the bug
> },
> $^X, "./helper.pl"
> );
>
> ==> helper.pl <==
> while ( <STDIN> ) {
> print "got `$_'";
> }
>
> $ strace -fq -e open,dup,dup2,fcntl,read,write,close,fork,clone,execve
> perl -Ilib ./main.pl
> [...]
> [pid 6973] open("./helper.pl", O_RDONLY) = 3
> [pid 6973] fcntl(3, F_SETFD, FD_CLOEXEC) = 0
> [pid 6973] read(3, "while ( <STDIN> ) {\n print \"g"..., 8192) =
> 44
> [pid 6973] read(3, "", 8192) = 0
> [pid 6973] close(3) = 0
> [pid 6973] read(0, "slopslopslop\n", 8192) = 13
> [pid 6973] read(0,
>
> ^C <detached ...>
> [test@fedora-21 Scriptalicious-1.16]$ main.pl: ERROR: Command
> `/usr/bin/perl ./helper.pl' killed by signal 2
>
> Here you can see the helper.pl blocks on reading STDIN because
> Scriptalicious does not close the pipe if capture() -out routine does
> exhibits <STDIN>. If you comment the out the line, this bug will not
> render.