develooper Front page | perl.perl5.porters | Postings from February 2018

Re: [perl #132810] Blead Breaks CPAN:KYZ/Test-MockCommand-0.03.tar.gz

Thread Next
From:
Slaven Rezic
Date:
February 4, 2018 18:38
Subject:
Re: [perl #132810] Blead Breaks CPAN:KYZ/Test-MockCommand-0.03.tar.gz
Message ID:
87bmh4a9jv.fsf@cvrsnica.herceg.de
"James E Keenan via RT" <perlbug-followup@perl.org> writes:

> On Sun, 04 Feb 2018 16:48:26 GMT, slaven@rezic.de wrote:
>> 
>> This is a bug report for perl from slaven@rezic.de,
>> generated with the help of perlbug 1.41 running under perl 5.27.8.
>> 
>> 
>> -----------------------------------------------------------------
>> The test t/playback-lines.t of Test-MockCommand-0.03 started to
>> fail with perl 5.27.7. A sample fail report at CPAN Testers:
>> http://www.cpantesters.org/cpan/report/1dde210a-0017-11e8-9b60-
>> e8bfa802ecd4
>> 
>> Additionally (maybe related?) there are new
>> "Can't exec "1": No such file or directory" warnings or errors,
>> something which did not happen with perl 5.26.6 or earlier.

Of course I meant 5.27.6 here...

>> 
>> 
>
> Bisection points to:
>
> #####
> 397baf232086e0a9ad6f881a9614d3dbaea853fc is the first bad commit
> commit 397baf232086e0a9ad6f881a9614d3dbaea853fc
> Author: Zefram <zefram@fysh.org>
> Date:   Tue Dec 12 06:24:01 2017 +0000
>
>     properly check readpipe()'s argument list
>     
>     readpipe() wasn't applying context to its argument list, resulting in
>     readpipe()'s context leaking in, and broken stack discipline when a list
>     expression was used.  Fixes [perl #4574].
>
> :100644 100644 1d319288829b58d993d1539c9de589560a327660 74de7524058bfdae374f0a00b376b58a25cd9358 M	op.c
> :040000 040000 479eaaefdbc8cb7387760b7de1619642188a22c6 d9068755553c5231c0db935533296c79fe122513 M	t
> bisect run success
> That took 1268 seconds.
> #####

Probably can be reduced to:

$ perl5.27.6 -w -MTest::More=no_plan -e 'my $res = join "", readpipe(@{[ "echo 1" ]}); is $res, "1\n"'
ok 1
1..1
$ perl5.27.7 -w -MTest::More=no_plan -e 'my $res = join "", readpipe(@{[ "echo 1" ]}); is $res, "1\n"'
Can't exec "1": No such file or directory at -e line 1.
not ok 1
#   Failed test at -e line 1.
#          got: ''
#     expected: '1
# '
1..1
# Looks like you failed 1 test of 1.


Possible patch for the module:

diff --git i/lib/Test/MockCommand/Recorder.pm w/lib/Test/MockCommand/Recorder.pm
index f2f87ec..595e9f7 100644
--- i/lib/Test/MockCommand/Recorder.pm
+++ w/lib/Test/MockCommand/Recorder.pm
@@ -142,7 +142,7 @@ sub record_readpipe {
     my %args = @_;
     # handle() will automatically split this according to $/
     # if needed, but we always return it as a scalar
-    return join '', CORE::readpipe(@{$args{arguments}});
+    return join '', CORE::readpipe($args{arguments}->[-1]);
 }
 
 1;

-- 
Slaven Rezic - slaven <at> rezic <dot> de
  BBBike - route planner for cyclists in Berlin
  WWW version:                           http://www.bbbike.de
  Perl/Tk version for Unix and Windows:  http://bbbike.sourceforge.net

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