Skip Menu |
Report information
Id: 132810
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: slaven [at] rezic.de
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



To: perlbug [...] perl.org
From: slaven [...] rezic.de
Date: Sun, 04 Feb 2018 17:47:30 +0100
Subject: Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
CC: srezic [...] cpan.org
Download (untitled) / with headers
text/plain 3.3k
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. ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.27.8: Configured by eserte at Sat Jan 20 09:22:10 CET 2018. Summary of my perl5 (revision 5 version 27 subversion 8) configuration: Platform: osname=linux osvers=3.16.0-4-amd64 archname=x86_64-linux uname='linux cabulja 3.16.0-4-amd64 #1 smp debian 3.16.51-3 (2017-12-13) x86_64 gnulinux ' config_args='-ds -e -Dprefix=/opt/perl-5.27.8 -Dusedevel -Dusemallocwrap=no -Dcf_email=srezic@cpan.org' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2' optimize='-O2' cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='' gccversion='4.9.2' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='double' nvsize=8 Off_t='off_t' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='cc' ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.19.so so=so useshrplib=false libperl=libperl.a gnulibc_version='2.19' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E' cccdlflags='-fPIC' lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong' --- @INC for perl 5.27.8: /opt/perl-5.27.8/lib/site_perl/5.27.8/x86_64-linux /opt/perl-5.27.8/lib/site_perl/5.27.8 /opt/perl-5.27.8/lib/5.27.8/x86_64-linux /opt/perl-5.27.8/lib/5.27.8 --- Environment for perl 5.27.8: HOME=/home/eserte LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/eserte/bin/linux-gnu:/home/eserte/bin/sh:/home/eserte/bin:/home/eserte/bin/pistachio-perl/bin:/usr/games:/home/eserte/devel PERLDOC=-MPod::Perldoc::ToTextOverstrike PERL_BADLANG (unset) SHELL=/bin/zsh
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.3k
On Sun, 04 Feb 2018 16:48:26 GMT, slaven@rezic.de wrote: Show quoted text
> > 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. > >
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. ##### -- James E Keenan (jkeenan@cpan.org)
Date: Sun, 04 Feb 2018 19:34:12 +0100
Subject: Re: [perl #132810] Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
To: "James E Keenan via RT" <perlbug-followup [...] perl.org>
CC: KYZ [...] cpan.org
From: Slaven Rezic <slaven [...] rezic.de>
Download (untitled) / with headers
text/plain 2.6k
"James E Keenan via RT" <perlbug-followup@perl.org> writes: Show quoted text
> 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... Show quoted text
>> >>
> > 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
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.7k
On Sun, 04 Feb 2018 18:38:27 GMT, slaven@rezic.de wrote: Show quoted text
> "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;
Looks good to me. Works on perl-5.26.0 and on blead. Can you submit that patch upstream? (https://rt.cpan.org/Dist/Display.html?Name=Test-MockCommand) -- James E Keenan (jkeenan@cpan.org)
CC: James E Keenan via RT <perlbug-followup [...] perl.org>, KYZ [...] cpan.org
To: Slaven Rezic <slaven [...] rezic.de>
Date: Sun, 4 Feb 2018 22:12:45 +0100
Subject: Re: [perl #132810] Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
From: Leon Timmermans <fawaka [...] gmail.com>
Download (untitled) / with headers
text/plain 898b
On Sun, Feb 4, 2018 at 7:34 PM, Slaven Rezic <slaven@rezic.de> wrote: Show quoted text
>>> >>>
>> >> 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]. >>
This essentially changed the prototype of a keyword. I don't think that sort of breaking change should happen without a proper discussion about it. I don't mind breaking broken code, but I see to reason to break code that had been working fine for 20+ years. It seems to me we can fix this in less painful ways. Leon
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 831b
On Sun, 04 Feb 2018 13:14:09 -0800, LeonT wrote: Show quoted text
> This essentially changed the prototype of a keyword. I don't think > that sort of breaking change should happen without a proper discussion > about it.
But the previous behaviour would mess up the stack. And readpipe’s own arguments would be evaluated in one context one time and another context another time. That’s clearly a bug. Show quoted text
> I don't mind breaking broken code, but I see to reason to break code > that had been working fine for 20+ years. It seems to me we can fix > this in less painful ways.
Do you have a better suggestion? If it is only one module that is affected, I think we should leave the fix in, as there is no logical, consistent way to make a core function that takes exactly one argument put that argument in list context. -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
On Mon, 05 Feb 2018 00:50:20 GMT, sprout wrote: Show quoted text
> On Sun, 04 Feb 2018 13:14:09 -0800, LeonT wrote:
> > This essentially changed the prototype of a keyword. I don't think > > that sort of breaking change should happen without a proper > > discussion > > about it.
> > But the previous behaviour would mess up the stack. And readpipe’s > own arguments would be evaluated in one context one time and another > context another time. That’s clearly a bug. >
> > I don't mind breaking broken code, but I see to reason to break code > > that had been working fine for 20+ years. It seems to me we can fix > > this in less painful ways.
> > Do you have a better suggestion? If it is only one module that is > affected, I think we should leave the fix in, as there is no logical, > consistent way to make a core function that takes exactly one argument > put that argument in list context.
Philosophically, I agree with Leon. Empirically, however, I agree with Father C. I used 'grep.cpan.me' to identify CPAN distros with the string 'readpipe'. While I did not attempt to test all such distros, I did test a large subset thereof. With prerequisites, 310 distros were installed. While there were some FAILs, none appeared to have anything to do with 'readpipe'. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
To: perlbug <perlbug-followup [...] perl.org>
Date: Mon, 5 Feb 2018 14:32:40 +0100
Subject: Re: [perl #132810] Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
CC: Perl5 Porters <perl5-porters [...] perl.org>
From: Leon Timmermans <fawaka [...] gmail.com>
Download (untitled) / with headers
text/plain 1.9k
On Mon, Feb 5, 2018 at 1:50 AM, Father Chrysostomos via RT <perlbug-followup@perl.org> wrote: Show quoted text
> On Sun, 04 Feb 2018 13:14:09 -0800, LeonT wrote:
>> This essentially changed the prototype of a keyword. I don't think >> that sort of breaking change should happen without a proper discussion >> about it.
> > But the previous behaviour would mess up the stack. And readpipe’s own arguments would be evaluated in one context one time and another context another time. That’s clearly a bug.
It is clearly a bug. I wasn't arguing for a revert, I'm arguing for a different fix. Show quoted text
>> I don't mind breaking broken code, but I see to reason to break code >> that had been working fine for 20+ years. It seems to me we can fix >> this in less painful ways.
> > Do you have a better suggestion?
Making it a scalar op is clearly not the only way to restore stack sanity (even if it may be the easiest one). It wouldn't have been different if this had been done in 1993 when readpipe was added, but we're a generation beyond that point. * Any solution where passing more or less than one argument doesn't cause a warning is not as helpful as it could be. * Evaluating to the number of arguments is never useful. * Any solution where code that has worked for a generation is suddenly no longer working is harmful. Such harm needs to be justified by a direct need for that breakage. That need doesn't exist, because this can be fixed by making it a well-behaved listop. So: * if arguments > 1 we should use the last value (as is currently done) and warn. * if arguments == 0 we should not run anything and warn about it. * if arguments == 1, everybody gets pizza. Show quoted text
> If it is only one module that is affected, I think we should leave the fix in, as there is no logical, consistent way to make a core function that takes exactly one argument put that argument in list context.
The argument "the breakage isn't too large" (whether that's true or not) isn't convincing to me when the breakage isn't necessary. Leon
From: Sawyer X <xsawyerx [...] gmail.com>
Date: Mon, 5 Feb 2018 16:27:23 +0200
Subject: Re: [perl #132810] Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.1k
On 02/05/2018 03:32 PM, Leon Timmermans wrote: Show quoted text
> On Mon, Feb 5, 2018 at 1:50 AM, Father Chrysostomos via RT > <perlbug-followup@perl.org> wrote:
>> On Sun, 04 Feb 2018 13:14:09 -0800, LeonT wrote:
>>> This essentially changed the prototype of a keyword. I don't think >>> that sort of breaking change should happen without a proper discussion >>> about it.
>> But the previous behaviour would mess up the stack. And readpipe’s own arguments would be evaluated in one context one time and another context another time. That’s clearly a bug.
> It is clearly a bug. I wasn't arguing for a revert, I'm arguing for a > different fix.
You're making two arguments: 1. Different technical solution. 2. Not making such a change without further "proper discussion" about it. I think there is always room for improved technical solution and little argument about that. I am not in a position to evaluated your suggested improved solution below but I would like others to do so. If there is a better solution, let's take it. As for the second problem, I think you make a good point there too. I was wondering what the documentation says because that's at least something to lean on in the discussion. If the documentation says "This is how you use this," then we have some room (taken very loosely here) in making it work the way we promise. With less room we would need to unfix it and change the documentation to reflect "Sorry, it isn't the way we said it would be. It is this way." The documentation for readpipe() does not explain the input except "EXPR". It does point to qx() and that documentation indicates the input for qx() is a string. This also point to "I/O Operators" for further reading. perlop contains that part but that doesn't seem to shed more lights on the input of qx() or readpipe(). We could interpret this as "We didn't declare what you can't do, so all bets are off" (which is sometimes the case) or "We should indicate in the documentation what should happen and at least now we're checking for it." I'm honestly not sure on which case we fall here. I think the ability to resolve this technically could help yield a different outcome.
RT-Send-CC: perl5-porters [...] perl.org
On Mon, 05 Feb 2018 05:33:20 -0800, LeonT wrote: Show quoted text
> Making it a scalar op is clearly not the only way to restore stack > sanity (even if it may be the easiest one). It wouldn't have been > different if this had been done in 1993 when readpipe was added, but > we're a generation beyond that point. > > * Any solution where passing more or less than one argument doesn't > cause a warning is not as helpful as it could be. > * Evaluating to the number of arguments is never useful. > * Any solution where code that has worked for a generation is suddenly > no longer working is harmful. Such harm needs to be justified by a > direct need for that breakage. > > That need doesn't exist, because this can be fixed by making it a > well-behaved listop. So: > * if arguments > 1 we should use the last value (as is currently done) > and warn. > * if arguments == 0 we should not run anything and warn about it. > * if arguments == 1, everybody gets pizza.
Yes, that could work. But do note that no other perl operator works that way, as far as I know. -- Father Chrysostomos
To: Perl5 Porters <perl5-porters [...] perl.org>
Date: Tue, 6 Feb 2018 16:31:29 +0000
From: Zefram <zefram [...] fysh.org>
Subject: Re: [perl #132810] Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
Leon Timmermans wrote: Show quoted text
> this can be fixed by making it a >well-behaved listop.
No it can't. The pre-5.27.7 behaviour puts the argument expression into scalar context if readpipe() itself is in scalar context. A well-behaved list op always puts its arguments into list context, so your proposal would break any code that relied on the scalar context. There is no well-behaved treatment of arguments that matches the pre-5.27.7 treatment of readpipe()'s arguments, even when consideration is restricted to those cases that didn't break stack discipline. There is no prototype that would correspond to that behaviour. It *is* technically possible to reimplement the old argument handling deliberately, with some chosen change only to the stack-breaking case. But it wouldn't qualify as any kind of well-behaved. It would be a unique exception to the rules, and the keyword would have to lose its prototype to avoid being misdescribed by it. I am still satisfied that making readpipe() the scalar operator that it was always intended to be was the right way to resolve this. -zefram
To: perl5-porters [...] perl.org
Subject: Re: [perl #132810] Blead Breaks CPAN: KYZ/Test-MockCommand-0.03.tar.gz
Date: Tue, 6 Feb 2018 16:34:16 +0000
From: Zefram <zefram [...] fysh.org>
Download (untitled) / with headers
text/plain 453b
Leon Timmermans wrote: Show quoted text
>This essentially changed the prototype of a keyword. I don't think >that sort of breaking change should happen without a proper discussion >about it.
Almost any bugfix runs the risk that something was relying on the buggy behaviour. It's impossible to predict which ones in particular will break something on CPAN. It would be impossibly cumbersome to have the kind of discussion you're proposing about every bugfix. -zefram


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org