Control: reassign -1 libwx-perl 1:0.9932-6 Control: retitle -1 libxwx-perl: Wx::InputStream::READLINE returns non-string value Control: tag -1 patch Control: affects -1 libwx-perl-processstream-perl
(Full quote for context, see below for discussion.) On Sun, Jul 03, 2022 at 05:29:36PM +0300, Niko Tyni wrote: > Source: libwx-perl-processstream-perl > Version: 0.32-1.1 > Tags: ftbfs > User: debian-p...@lists.debian.org > Usertags: perl-5.36-transition > > This package fails to build from source with Perl 5.36 (currently in > experimental.) > > Build log at > > > http://perl.debian.net/rebuild-logs/perl-5.36-throwaway/libwx-perl-processstream-perl_0.32-1.1/libwx-perl-processstream-perl_0.32-1.1_amd64-2022-06-13T09:38:04Z.build > > Excerpt: > > t/00-load.t .... > 1..1 > ok 1 - use Wx::Perl::ProcessStream; > ok > > # Failed test at t/01-events.t line 59. > # got: undef > # expected: '0' > > # Failed test at t/01-events.t line 80. > # got: undef > # expected: 'HELLO WORLD' > > # Failed test at t/01-events.t line 94. > # got: undef > # expected: 'HELLO WORLD' > > # Failed test at t/01-events.t line 117. > # got: undef > # expected: 'HELLO WORLD' > > # Failed test at t/01-events.t line 131. > # got: undef > # expected: 'HELLO WORLD' > > # Failed test at t/01-events.t line 152. > # got: '' > # expected: anything else > > # Failed test at t/01-events.t line 170. > # got: '' > # expected: 'ONE-TWO-THREE' > > # Failed test at t/01-events.t line 174. > # got: '' > # expected: 'FOUR' > > # Failed test at t/01-events.t line 192. > # got: '' > # expected: 'ECHO:TEST STDIN 1-TEST STDIN 2' > E: Build killed with signal TERM after 150 minutes of inactivity This seems to be a bug in libwx-perl, triggered by changes in Perl 5.35.9 or so. >From https://metacpan.org/dist/perl/view/pod/perldelta.pod#Internal-Changes : Reading the string form of an integer value no longer sets the flag SVf_POK. [...] Here's a snippet that shows the changed behaviour: #!/usr/bin/perl -w use Test::More tests => 3; use Devel::Peek; use Inline C => <<'EOC'; SV * myString() { SV *ret; ret = newSViv(0); char *buf = SvPV_nolen(ret); buf[0] = '1'; return ret; } EOC my $val = myString(); is($val, "1", "XS return value equals the string 1"); is($val, 1, "XS return value equals numeric 1"); ok($val, "XS return value is true"); Dump $val; __END__ The return value is created as the integer zero, then its string buffer is changed but the corresponding SvPOK flag is not set. This passes all the three tests on sid / Perl 5.34 fails the last one with Perl 5.36. The Dump output shows - FLAGS = (IOK,POK,pIOK,pPOK) + FLAGS = (IOK,pIOK,pPOK) and explicitly declaring the variable a valid string by adding an SvPOK_on(ret) call fixes the tests. The above snippet was adapted from the Wx::InputStream::READLINE() method in libwx-perl, which has the same issue. The Wx::Perl::ProcessStream test suite tests if the return value is set, but sees it evaluate to false and assumes an early EOF, breaking the tests. Proposed patch attached. I've tested that it fixes the test suite with Perl 5.36 without breaking it on sid / 5.34. -- Niko Tyni nt...@debian.org
>From 41bcb4f309b5a8f13dfa9c6d417369938cbe6060 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Sun, 10 Jul 2022 16:53:10 +0100 Subject: [PATCH] Explicitly return a string SV from Wx::InputStream::READLINE Perl 5.35.9 changed SV integer / string handling slightly, resulting in the return value from READLINE() to evaluate as false regardless of its string contents, because it is initially created as the integer 0 and no longer gets marked as a valid string. This broke the Wx-Perl-ProcessStream distribution test suite. Fix the regression by explicitly setting SvPOK on the return value, mirroring the sibling READ() method. Bug-Debian: https://bugs.debian.org/1014295 --- XS/Stream.xs | 1 + 1 file changed, 1 insertion(+) diff --git a/XS/Stream.xs b/XS/Stream.xs index b6ef184..f680394 100644 --- a/XS/Stream.xs +++ b/XS/Stream.xs @@ -97,6 +97,7 @@ Wx_InputStream::READLINE() if( THIS->Eof() ) { XSRETURN_UNDEF; } RETVAL = newSViv( 0 ); buff = SvPV_nolen( RETVAL ); + SvPOK_on( RETVAL ); while( THIS->CanRead() && THIS->Read( &c, 1 ).LastRead() != 0 ) { -- 2.35.2