develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #122112] refcnt: fd -1 < 0 with MIME::Lite

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
June 25, 2019 06:16
Subject:
[perl #122112] refcnt: fd -1 < 0 with MIME::Lite
Message ID:
rt-4.0.24-12444-1561443395-500.122112-15-0@perl.org
On Fri, 31 May 2019 21:41:49 -0700, rich@hyphen-dash-hyphen.info wrote:
> On Thu, May 30, 2019 at 1:36 AM Tony Cook via RT
> <perlbug-followup@perl.org> wrote:
> > Test case applied as fb5e77103dd443cc2112ba14dc665aa5ec072ce6 and the
> > simple fix as 35608a1658fe75c79ca53d96aea6cf7cb2a98615.
> 
> Hi Tony,
> 
> io/pipe.t has just started hanging on my Android builds, seemingly
> since these commits. Output from a manual poke below.
> 
> I'll have time over the weekend to look in more detail, is there any
> specific debugging you'd like me to do?
> 
> $ ./perl harness -v io/pipe.t
> io/pipe.t ..
> 1..27
> ok 1 - open |- || exec
> ok 2 -    again
> ok 3 - open -|
> ok 4 -     again
> ok 5 - '97 98 99 10 114 115 116 13 120 121 122 13 10 102 111 111 10'
> passes through '-|'
> ok 6 - '97 98 99 10 114 115 116 13 120 121 122 13 10 102 111 111 10'
> passes through '|-'
> ok 7 - pipe & fork
> ok 8 -     with fh dup
> ok 10
> ok 11 - pipe endpoints not inherited across exec
> ok 12 - close error on broken pipe
> ok 13 - close failure on non-zero piped exit
> ok 14 -        errno
> ok 15 -        status
> ok 16 - close failure for... umm, something
> ok 17 -        status
> ok 18 -        errno
> ok 19 - status correct after wait
> ok 20 -        wait pid
> ok 21 -        errno
> ok 22 - missing command in piped open input
> ok 23 -                               output
> ok 24 - status unaffected by implicit close
> ok 25 - child reaped if piped program cannot be executed
> $SIG{ALRM}=sub{die};
> alarm 1;
> $Perl = "./perl";
> my $cmd = qq($Perl -e "sleep 3");
> my $pid = open my $fh, "|$cmd" or die "$!
> ";
> close $fh;
> ok 26 - no exception from PerlIO
> ok 27 - but we did get the exception from die
> Failed 1/27 subtests
> 
> Test Summary Report
> -------------------
> io/pipe.t (Wstat: 0 Tests: 26 Failed: 0)
>   Parse errors: Tests out of sequence.  Found (10) but expected (9)
>                 Tests out of sequence.  Found (11) but expected (10)
>                 Tests out of sequence.  Found (12) but expected (11)
>                 Tests out of sequence.  Found (13) but expected (12)
>                 Tests out of sequence.  Found (14) but expected (13)
> Displayed the first 5 of 19 TAP syntax errors.
> Re-run prove with the -p option to see them all.
> Files=1, Tests=26, 12 wallclock secs ( 0.06 usr  0.01 sys +  0.36 cusr
>  0.14 csys =  0.57 CPU)
> Result: FAIL

There were two problems, one that 2fe0d7f40a94163d6c242c3e695fdcd19e387422 fixed, the extraneous output from the test.

The other problem was that the PIPE signal wasn't being delivered when the test wasn't being run through make, ie. any of the following failed to output "ok 9":

  cd t ; ./perl -I../lib io/pipe.t
  cd t ; ./perl harness io/pipe.t
  TEST_FILES=io/pipe.t ./runtests choose

but:

  make test TEST_FILES=io/pipe.t

worked.

It turned out to be that the problem was that SIGPIPE was blocked, presumably something in make was unblocking it.

The attached adjusts the signal mask so that SIGPIPE isn't blocked, assuming the right POSIX APIs are available, the eval should ensure nothing happens if the APIs aren't available.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122112

Thread Previous | Thread Next


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