perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

BBC: Scalar-List-Utils-1.65 breaks Tie::RefHash::Weak

Open jkeenan opened this issue 1 year ago • 10 comments

CPAN distribution Tie-RefHash-Weak has begun to experience test failures on CPANtesters. Sample failure report: http://www.cpantesters.org/cpan/report/c2837ae0-5ce3-11ef-bb02-ec823e4a88bb

Excerpt from failure output:

PERL_DL_NONLAZY=1 "/usr/home/jkeenan/testing/blead/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Can't coerce ARRAY to integer in goto at /usr/home/jkeenan/.cpan/build/Tie-RefHash-Weak-0.09-0/blib/lib/Tie/RefHash/Weak.pm line 48.
# Looks like your test exited with 255 just after 6.
t/01basic.t ....... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 20/26 subtests 
Can't coerce ARRAY to integer in goto at /usr/home/jkeenan/.cpan/build/Tie-RefHash-Weak-0.09-0/blib/lib/Tie/RefHash/Weak.pm line 48.
# Looks like your test exited with 255 just after 1.
t/02gc.t .......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 9/10 subtests 
t/fieldhash.t ..... ok
Can't coerce ARRAY to integer in goto at /usr/home/jkeenan/.cpan/build/Tie-RefHash-Weak-0.09-0/blib/lib/Tie/RefHash/Weak.pm line 48.
# Looks like your test exited with 255 just after 1.
t/overload.t ...... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/6 subtests 

Bisection with the following invocation:

perl Porting/bisect.pl \
--module=Tie::RefHash::Weak \
--start=bcb5884b9b0ae1345ac74420bacb865ba11baab3 \
--end=b52ac0882220a4eb961f5028163fb75494704d7a

... points to :

commit d174c09669a057e017279ced5d33589ab3b9d10e (HEAD, refs/bisect/bad)
Author:     Paul Evans <[email protected]>
AuthorDate: Wed Aug 14 21:10:35 2024 -0400
Commit:     James E Keenan <[email protected]>
CommitDate: Wed Aug 14 21:10:41 2024 -0400

    cpan/Scalar-List-Utils - Update to version 1.65

That is, synching the most recent version of Scalar-List-Utils into blead triggered these failures. @leonerd, can you take a look? Thanks.

Cited upstream: https://rt.cpan.org/Ticket/Display.html?id=155006

jkeenan avatar Aug 21 '24 16:08 jkeenan

Probably the same root cause:

$ ./perl -Ilib -e 'use Tie::RefHash (); Tie::RefHash::refaddr(0)'
Segmentation fault

mauke avatar Aug 21 '24 16:08 mauke

... which in turn reduces to:

$ perl -e 'sub { goto &builtin::refaddr; }->(0)'
Segmentation fault

mauke avatar Aug 21 '24 16:08 mauke

Huh. Exciting times:

$ bleadperl -E 'sub { goto &builtin::refaddr }->(0)'
panic: pad_sv po at -e line 1.

Seems to be specifically related to the tailcall though, because similar invocations don't fail:

$ bleadperl -E 'my $f = \&builtin::refaddr; $f->(0)'

$ bleadperl -E 'builtin::refaddr 0'

(both run OK)

leonerd avatar Aug 21 '24 17:08 leonerd

Tie-RefHash-1.41 has been released which will fix this (thanks @mauke).

karenetheridge avatar Aug 25 '24 22:08 karenetheridge

(reopened.. Scalar::Util still needs to be fixed; just the collateral damage has been fixed so far)

karenetheridge avatar Aug 25 '24 22:08 karenetheridge

Tie-RefHash-1.41 has been released which will fix this (thanks @mauke).

Was Tie-RefHash experiencing test failures? The failures I reported in this ticket were in Tie-RefHash-Weak.

jkeenan avatar Aug 26 '24 00:08 jkeenan

The errors in Tie-RefHash-Weak were caused by faulty code in Tie::RefHash.

karenetheridge avatar Aug 26 '24 01:08 karenetheridge

I've sync'd Tie::RefHash into core. Hopefully the workaround there will fix the Tie::RefHash::Weak errors. Once that is confirmed, we can close this issue, I think.

For the underlying root cause (crash in goto &builtin::refaddr) I've opened #22542. This is (sadly) not a regression: The builtin subs have been crashing since they were introduced in v5.36.

mauke avatar Aug 26 '24 03:08 mauke

Also affected by recent List::Util: Util-Underscore-v1.4.2; see https://github.com/latk/p5-Util-Underscore/issues/10

@leonerd , can you have a look there as well?

andk avatar Aug 27 '24 03:08 andk

Same root cause. https://metacpan.org/dist/Util-Underscore/source/lib/Util/Underscore/References.pm is full of goto &Scalar::Util::..., the Scalar::Util functions are simply aliases for builtin ones (since 1.64), and goto &builtin::... is broken, which is #22542.

mauke avatar Aug 27 '24 04:08 mauke

With the recent merge of https://github.com/Perl/perl5/pull/22582/, which fixed https://github.com/Perl/perl5/issues/22542, the CPAN distributions cited in this ticket are now PASSing on CPANtesters.

http://fast-matrix.cpantesters.org/?dist=Tie-RefHash-Weak;perl=5.41.4;reports=1#sl=7,1

http://fast-matrix.cpantesters.org/?dist=Util-Underscore;perl=5.41.4;reports=1#sl=7,1

Labelling this ticket Closable.

jkeenan avatar Sep 17 '24 12:09 jkeenan

With the recent merge of #22582, which fixed #22542, the CPAN distributions cited in this ticket are now PASSing on CPANtesters.

http://fast-matrix.cpantesters.org/?dist=Tie-RefHash-Weak;perl=5.41.4;reports=1#sl=7,1

http://fast-matrix.cpantesters.org/?dist=Util-Underscore;perl=5.41.4;reports=1#sl=7,1

Labelling this ticket Closable.

Closing.

jkeenan avatar Sep 22 '24 23:09 jkeenan