Skip Menu |

This queue is for tickets about the B-Lint CPAN distribution.

Report information
The Basics
Id: 101115
Status: open
Priority: 0/
Queue: B-Lint

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc: gregoa [...] cpan.org
hasch-cpan [...] cozap.com
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.20
Fixed in: (no value)



Subject: Test failure with perl 5.21.7
See http://www.cpantesters.org/cpan/report/fb0716c8-8a7b-11e4-b728-96badfbfc7aa for a sample report: PERL_DL_NONLAZY=1 "/opt/perl-5.21.7/bin/perl5.21.7" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t # Failed at t/lint.t line 119 # got 'Bare sub name \'bare\' interpreted as string at -e line 1 # ' # expected 'Bare sub name \'bare\' interpreted as string at -e line 1 # Bare sub name \'bare\' interpreted as string at -e line 1 # ' t/lint.t .. Failed 1/29 subtests
RT-Send-CC: davem [...] iabyn.com
On Wed Dec 24 05:45:11 2014, SREZIC wrote: Show quoted text
> See http://www.cpantesters.org/cpan/report/fb0716c8-8a7b-11e4-b728- > 96badfbfc7aa for a sample report: > > PERL_DL_NONLAZY=1 "/opt/perl-5.21.7/bin/perl5.21.7" "- > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > t/*.t > # Failed at t/lint.t line 119 > # got 'Bare sub name \'bare\' interpreted as string at -e line 1 > # ' > # expected 'Bare sub name \'bare\' interpreted as string at -e line 1 > # Bare sub name \'bare\' interpreted as string at -e line 1 > # ' > t/lint.t .. > Failed 1/29 subtests
The documentation for B::Lint says: =item B<bare-subs> This option warns whenever a bareword is implicitly quoted, but is also the name of a subroutine in the current package. Typical mistakes that it will trap are: use constant foo => 'bar'; @a = ( foo => 1 ); $b{foo} = 2; However, with the multideref optimisation, it is no longer possible to distinguish between $y{bare} and $y{"bare"}. Notice how, in 5.20, we have the BARE flag set on the key in the first example: $ perl5.20.1 -MO=Concise -e '$y{bare}' 7 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 6 <2> helem vK/2 ->7 4 <1> rv2hv sKR/1 ->5 3 <$> gv(*y) s ->4 5 <$> const(PV "bare") s/BARE ->6 -e syntax OK $ perl5.20.1 -MO=Concise -e '$y{"bare"}' 7 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 6 <2> helem vK/2 ->7 4 <1> rv2hv sKR/1 ->5 3 <$> gv(*y) s ->4 5 <$> const(PV "bare") s ->6 -e syntax OK $ ./perl -Ilib -MO=Concise -e '$y{bare}' 4 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 - <1> ex-helem vK/2 ->4 3 <+> multideref($y{"bare"}) vK ->4 - <0> ex-gv s ->3 -e syntax OK $ ./perl -Ilib -MO=Concise -e '$y{"bare"}' 4 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 - <1> ex-helem vK/2 ->4 3 <+> multideref($y{"bare"}) vK ->4 - <0> ex-gv s ->3 -e syntax OK So I am not sure what the best approach is here. Should we perhaps have B::Lint enable PERLDB_NOOPT and make multideref respect that?
From: ppisar [...] redhat.com
Dne St 24.pro.2014 05:45:11, SREZIC napsal(a): Show quoted text
> See http://www.cpantesters.org/cpan/report/fb0716c8-8a7b-11e4-b728- > 96badfbfc7aa for a sample report: > > PERL_DL_NONLAZY=1 "/opt/perl-5.21.7/bin/perl5.21.7" "- > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > t/*.t > # Failed at t/lint.t line 119 > # got 'Bare sub name \'bare\' interpreted as string at -e line 1 > # ' > # expected 'Bare sub name \'bare\' interpreted as string at -e line 1 > # Bare sub name \'bare\' interpreted as string at -e line 1 > # ' > t/lint.t .. > Failed 1/29 subtests
Until a proper fix will be implemented, here is a patch documenting this issue and skipping a relevant test.
Subject: B-Lint-1.20-Skip-a-bare-sub-test.patch
From d350b6338066d2563b4abacf1eb7da56c5264b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Fri, 12 Jun 2015 13:27:07 +0200 Subject: [PATCH] Skip a bare-sub test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl 5.22 optimization causes B::Lint not to recognize $a{b} for bare-sub check. This patch document this deficency and skips a test for it. Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/B/Lint.pm | 4 ++++ t/lint.t | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/B/Lint.pm b/lib/B/Lint.pm index 1f5098f..7291b18 100644 --- a/lib/B/Lint.pm +++ b/lib/B/Lint.pm @@ -85,6 +85,10 @@ trap are: Neither of these will do what a naive user would expect. +Notice: Perl 5.22.0 does not report C<foo> in C<$b{foo}> as BARE token +anymore. Therefore L<B::Lint> test is not reliable here. See +L<CPAN RT#101115|https://rt.cpan.org/Public/Bug/Display.html?id=101115>. + =item B<dollar-underscore> This option warns whenever C<$_> is used either explicitly anywhere or diff --git a/t/lint.t b/t/lint.t index 7317b1d..93255d9 100644 --- a/t/lint.t +++ b/t/lint.t @@ -14,7 +14,7 @@ BEGIN { use strict; use warnings; -plan tests => 29; +plan tests => 30; # Runs a separate perl interpreter with the appropriate lint options # turned on @@ -116,10 +116,17 @@ RESULT runlint 'bare-subs', 'sub bare(){1};$x=bare', ''; -runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]; $x=$y{bare}', <<'RESULT'; +runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]', <<'RESULT'; Bare sub name 'bare' interpreted as string at -e line 1 +RESULT + +SKIP: { + skip 'Perl 5.22 stopped marking $hash{bare} as BARE word, CPAN RT#101115', + 1, if $] >= 5.022; + runlint 'bare-subs', 'sub bare(){1}; $x=$y{bare}', <<'RESULT'; Bare sub name 'bare' interpreted as string at -e line 1 RESULT +} { -- 2.1.0
On Fri Jun 12 07:37:11 2015, ppisar wrote: Show quoted text
> Dne St 24.pro.2014 05:45:11, SREZIC napsal(a):
> > See http://www.cpantesters.org/cpan/report/fb0716c8-8a7b-11e4-b728- > > 96badfbfc7aa for a sample report: > > > > PERL_DL_NONLAZY=1 "/opt/perl-5.21.7/bin/perl5.21.7" "- > > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > > t/*.t > > # Failed at t/lint.t line 119 > > # got 'Bare sub name \'bare\' interpreted as string at -e line 1 > > # ' > > # expected 'Bare sub name \'bare\' interpreted as string at -e line 1 > > # Bare sub name \'bare\' interpreted as string at -e line 1 > > # ' > > t/lint.t .. > > Failed 1/29 subtests
> > Until a proper fix will be implemented, here is a patch documenting > this issue and skipping a relevant test.
It seems this issue is still unresolved. While taking a look at https://rt.perl.org/Ticket/Display.html?id=38875, I tried to use 'cpanm' to install B::Lint. I got these errors: ##### Building and testing B-Lint-1.20 cp lib/B/Lint.pm blib/arch/B/Lint.pm cp lib/B/Lint/Debug.pm blib/arch/B/Lint/Debug.pm Manifying 2 pod documents PERL_DL_NONLAZY=1 "/home/jkeenan/perl5/perlbrew/perls/perl-5.24.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t # Failed at t/lint.t line 119 # got 'Bare sub name \'bare\' interpreted as string at -e line 1 # ' # expected 'Bare sub name \'bare\' interpreted as string at -e line 1 # Bare sub name \'bare\' interpreted as string at -e line 1 # ' t/lint.t .. Failed 1/29 subtests Test Summary Report ------------------- t/lint.t (Wstat: 0 Tests: 29 Failed: 1) Failed test: 27 Files=1, Tests=29, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.73 cusr 0.10 csys = 0.85 CPU) Result: FAIL Failed 1/1 test programs. 1/29 subtests failed. #####
Subject: Test failures with perl 5.21.7, perl 5.22.0 and up
A feature of B::Lint does not work in newer perls. It needs a piece of information that is not available anymore after some optimization. A workaround, while conceivable, does not seem trivial. All the rest of B::Lint, however, is still functional and arguably useful. As the test suite failure is now no longer a surprise, the matter should be documented as a known limitation and the test should report skip rather than failure, so that users can install the module without much of a hassle. A patch to that effect has already been supplied by Petr, more than two years ago. Please release that patch and move on. -Martin
Released as 1.21 -- Reini Urban
On 2017-11-13 11:20:25, RURBAN wrote: Show quoted text
> Released as 1.21
Reopened --- the newer releases are marked as "unauthorized" and are not indexed. So for example a normal CPAN install of B::Lint would still pick the old version.