Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

BBC: Blead Breaks Sub::Exporter #21269

Open cjg-cguevara opened 10 months ago

cjg-cguevara commented 10 months ago

This is a bug report for perl from "Carlos Guevara" carlos@carlosguevara.com, generated with the help of perlbug 1.43 running under perl 5.39.1.


BBC: Blead Breaks Sub::Exporter

Please see http://fast-matrix.cpantesters.org/?dist=Sub::Exporter


Flags

Configured by cpan at Wed Jul 19 23:35:05 EDT 2023.

Summary of my perl5 (revision 5 version 39 subversion 1) configuration: Commit id: 923dde9b8ebe55ba73323ed675156712bc0062c9 Platform: osname=linux osvers=5.15.120-0-lts archname=x86_64-linux-thread-multi uname='linux cjg-alpine3 5.15.120-0-lts #1-alpine smp wed, 05 jul 2023 18:59:57 +0000 x86_64 linux ' config_args='-des -Dprefix=/home/cpan/bin/perl -Dscriptdir=/home/cpan/bin/perl/bin -Dusedevel -Duse64bitall -Duseithreads' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define Compiler: cc='cc' ccflags ='-D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' optimize='-O2' cppflags='-D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong' ccversion='' gccversion='12.2.1 20220924' 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/lib /usr/local/lib /lib libs=-lpthread -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc libc=/usr/lib/libc.a so=so useshrplib=false libperl=libperl.a gnulibc_version='' 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.39.1: /home/cpan/bin/perl/lib/site_perl/5.39.1/x86_64-linux-thread-multi /home/cpan/bin/perl/lib/site_perl/5.39.1 /home/cpan/bin/perl/lib/5.39.1/x86_64-linux-thread-multi /home/cpan/bin/perl/lib/5.39.1


Environment for perl 5.39.1: HOME=/home/cpan LANG=C.UTF-8 LANGUAGE (unset) LC_COLLATE=C LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/cpan/bin/perl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PERL_BADLANG (unset) SHELL=/bin/bash

demerphq commented 10 months ago

This is a bug in Sub::Exporter's test suite, and is fixed by https://github.com/rjbs/Sub-Exporter/pull/17

demerphq commented 10 months ago

Happy Birthday @rjbs.

jkeenan commented 10 months ago

This is a bug in Sub::Exporter's test suite, and is fixed by rjbs/Sub-Exporter#17

Bisecting shows that this failure shows up in blead at this commit:

commit 2dcf3cf50d7cb67422ffe2c2a3e2d3dc404ea6c4 (HEAD, refs/bisect/bad)
Author:     Yves Orton <demerphq@gmail.com>
AuthorDate: Mon Feb 14 12:24:21 2022 +0100
Commit:     Yves Orton <demerphq@gmail.com>
CommitDate: Tue Jul 18 20:26:14 2023 +0200

    Fix assorted bugs related to not having a UNIVERSAL::import

... which is consistent with @demerphq's explanation. I suspect that since this commit went into blead just two days ago, we'll see other CPAN breakage connected to that commit and have to file tickets for other distros upstream.

demerphq commented 10 months ago

I suspect that since this commit went into blead just two days ago, we'll see other CPAN breakage connected to that commit and have to file tickets for other distros upstream.

Yep. Very very likely. This patch is specifically intended to detect people doing stuff that wouldn't be detected prior to it.

rjbs commented 10 months ago

Hey, thanks! I'm out of town on business, but this all looks like Yves is probably right, and I'll dig into it pretty soon.

andk commented 10 months ago

Also affected: LEONT/CPAN-Meta-Check-0.017.tar.gz @Leont please take note

demerphq commented 10 months ago

Re CPAN::Meta::Check:

------------------------------
PROGRAM OUTPUT
------------------------------

Output from '/usr/bin/make test':

PERL_DL_NONLAZY=1 "/tmp/basesmoker-reloperl-uCLf/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Attempt to call undefined import method with arguments via package "CPAN::Meta::Prereqs" (Perhaps you forgot to load the package?) at /tmp/loop_over_bdir-101935-CrkcWo/CPAN-Meta-Check-0.017-0/blib/lib/CPAN/Meta/Check.pm line 12.
BEGIN failed--compilation aborted at /tmp/loop_over_bdir-101935-CrkcWo/CPAN-Meta-Check-0.017-0/blib/lib/CPAN/Meta/Check.pm line 12.
Compilation failed in require at t/10-basics.t line 8.
BEGIN failed--compilation aborted at t/10-basics.t line 8.
t/10-basics.t ......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 
Attempt to call undefined import method with arguments via package "CPAN::Meta::Prereqs" (Perhaps you forgot to load the package?) at /tmp/loop_over_bdir-101935-CrkcWo/CPAN-Meta-Check-0.017-0/blib/lib/CPAN/Meta/Check.pm line 12.
BEGIN failed--compilation aborted at /tmp/loop_over_bdir-101935-CrkcWo/CPAN-Meta-Check-0.017-0/blib/lib/CPAN/Meta/Check.pm line 12.
Compilation failed in require at t/20-undef-version.t line 6.
BEGIN failed--compilation aborted at t/20-undef-version.t line 6.
t/20-undef-version.t .. 
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 

Test Summary Report
-------------------
t/10-basics.t       (Wstat: 65280 (exited 255) Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
t/20-undef-version.t (Wstat: 65280 (exited 255) Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: No plan found in TAP output
Files=2, Tests=0,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.14 cusr  0.02 csys =  0.17 CPU)
Result: FAIL
Failed 2/2 test programs. 0/0 subtests failed.
make: *** [Makefile:873: test_dynamic] Error 255
demerphq commented 10 months ago

Re: CPAN::Meta::Check, the offending line of code is

use CPAN::Meta::Prereqs '2.132830';

I guess this is intended to be a version Check, but since it's not a number it gets treated as an argument to import. We could probably handle this case more gracefully in UNIVERSAL::import(), but I'm not sure if we should, it seems preferable to keep it very simple. But perhaps we could add a bespoke error for this case to make it easier to understand what is going on.

Again, given the highly experienced nature of the author of this code it seems likely we will discover quite a bit more code where people thought they were doing something that were actually no-ops in disguise.

jkeenan commented 10 months ago

The impact of this breakage is massive. On both FreeBSD and Linux, I built perls from the v5.39.1 tag, attempted to install Task::CPAN::Reporter against them and generate CPANtesters reports from a list of 500 modules. Because Sub::Exporter is a prereq to Test::Reporter::Transport::Metabase, even though the modules were actually tested, no reports were sent and all were marked DISCARD.

We should consider reverting the breaking commit until we can better assess the impact of the change.

demerphq commented 10 months ago

We should consider reverting the breaking commit until we can better assess the impact of the change.

That sounds like an over-reaction to me personally. When @rjbs can roll a new release of Sub-Exporter things will go back to normal. Presumably if he wasn't on holiday this would be fixed already. We can wait a few days IMO.

Just force install Sub::Exporter for now. The only thing broken there is a test that doesn't quite do what he thought it did.

dur-randir commented 10 months ago

Looks like Moose is also hit by this

#   Failed test '... got the right list of applicable methods for Foo'
#   at t/cmop/methods.t line 211.
#     Structures begin differing at:
#          $got->[28] = 'import'
#     $expected->[28] = 'isa'

#   Failed test '... got the right list of applicable methods for Bar'
#   at t/cmop/methods.t line 302.
#     Structures begin differing at:
#          $got->[28] = 'import'
#     $expected->[28] = 'isa'
# Looks like you failed 2 tests of 81.

Out of my to-install list, I see ~80 failures, but didn't dive into them thoroughly.

demerphq commented 10 months ago

@dur-randir it would be helpful if you could look into the different cases you are seeing and give us some kind of summary of the error modes you see.

The Moose one is interesting, it is enumerating the list of methods in a given class, and is now seeing an import method that didn't used to exist. This is interesting because it is really a very different type of error compared to the errors that are expected from this and possibly we can fix it without breaking the intent of this change.

Cases where people really are calling non-existent imports with arguments thinking they are doing something useful, like a version check or import, really should be errors, even if it is irritating that so many cases are to be found in key parts of the CPAN toolchain. Those can be managed for the time being in the internals where they are important.

So have a breakdown of the different causes of this would be very useful if possible.

Leont commented 10 months ago

Also affected: LEONT/CPAN-Meta-Check-0.017.tar.gz @Leont please take note

Released a fixed version

dur-randir commented 10 months ago
#   at t/011-class.t line 275.
#          got: 'Foo  {
#     parents: Bar
#     public methods (11): bar (Bar), baz, borg, can (UNIVERSAL), DOES (UNIVERSAL), foo, import (UNIVERSAL), isa (UNIVERSAL), new, unimport (UNIVERSAL), VERSION (UNIVERSAL)
#     private methods (2): _moo (Bar), _other
#     internals: {
#         test   42
#     }
# }'
#     expected: 'Foo  {
#     parents: Bar
#     public methods (9): bar (Bar), baz, borg, can (UNIVERSAL), DOES (UNIVERSAL), foo, isa (UNIVERSAL), new, VERSION (UNIVERSAL)
#     private methods (2): _moo (Bar), _other
#     internals: {
#         test   42
#     }
# }'
andk commented 10 months ago

Also affected: XAVIER/Graphics-ColorNames-Mozilla-0.11.tar.gz Sample report: http://www.cpantesters.org/cpan/report/3f34e38e-27b2-11ee-888a-1af50765aee6

andk commented 10 months ago

Also affected: PMAKHOLM/Encode-IMAPUTF7-1.05.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/cc70611e-27b3-11ee-8776-32f80765aee6

demerphq commented 10 months ago

Graphics-ColorNames-Mozilla

This has broken code in its test logic. It is attempting to import a sub from a class.

Issue reported in: https://rt.cpan.org/Ticket/Display.html?id=149090

Encode-IMAPUTF7

This also appears to be broken test logic. It attempts to import subs, but it does not use Exporter or define its own import method. It inherits from Encode::Encoding which also appears to not use Exporter or provide an import method.

Issue report in: https://rt.cpan.org/Ticket/Display.html?id=149091

Author is asking for a new owner and has issues that are over a decade old.

demerphq commented 10 months ago

I will push a patch shortly which will make the new UNIVERSAL::import() method handle version numbers the same as Exporter would, and silently convert

Thing->import("1.234");

into

Thing->VERSION("1.234");

Which should cover some of the issues reported here.

Basically there are three classes of issues that the UNIVERSAL::import() patch has surfaced:

  1. places where people are doing Thing->import("1.234") and expecting Exporter style behavior. Or writing use Thing "1.234"; and expecting it to be the same as use Thing 1.234; (this case may be combined with case 2)
  2. places where people are doing use Thing qw(blah); when there is not import method defined, and the blah isnt being used in any way.
  3. Places where people are testing the methods that are expected to be populated in a package, and seeing the new import/unimport methods and getting confused.

Case 1 should be fixed by my latest patch in https://github.com/Perl/perl5/pull/21279. Case 2 is a legit problem with the code that we report is broken, and that code should simply be fixed. Case 3 is a bit of a grey zone. I see broadly two positions one could take: A) You could argue that we should be able to add special methods to UNIVERSAL so people should just ignore any methods which are defined in it. B) You could also argue that since we have not defined a UNIVERSAL::import/UNIVERSAL::unimport for a long time that we should continue to not define it and do some other trick to achieve the goals we are trying to achieve here. I lean towards the A) interpretation.

dur-randir commented 10 months ago

TAP::Formatter::TeamCity also fails on 5.36, so it's a red herring.

haarg commented 10 months ago

Fix for JSON-Any at karenetheridge/JSON-Any#3

haarg commented 10 months ago

shlomif/perl-file-find-object#3

andk commented 10 months ago

Also affected: TEVERETT/Class-Prototyped-1.13.tar.gz Sample "unknown" report (fails during call of Build.PL): http://www.cpantesters.org/cpan/report/3fa170f8-2785-11ee-87ea-7996116755ad

haarg commented 10 months ago

moose/Moose#183

demerphq commented 10 months ago

Patched Perl::Critic: https://github.com/Perl-Critic/Perl-Critic/pull/1037

andk commented 10 months ago

Also affected: IBB/Acme-Damn-0.08.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/b90db89a-27ec-11ee-bc75-9caf0865aee6

demerphq commented 10 months ago

TEVERETT/Class-Prototyped-1.13.tar.gz has

use Module::Build '0.24';

and Module::Build doesnt define an import(), and especially does not use Exporter. It also has a bug report from 8 years ago, so I assume it is unmaintained.

demerphq commented 10 months ago

Also affected: IBB/Acme-Damn-0.08.tar.gz

fixed with https://github.com/denormal/perl-Acme-Damn/pull/1

haarg commented 10 months ago

garu/Data-Printer#180

haarg commented 10 months ago

abw/Template2#309

andk commented 10 months ago

Also affected: STRANGE/Locale-CLDR-Locales-Gd-v0.34.1.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/7c58c174-27fb-11ee-b708-a3f90865aee6

andk commented 10 months ago

Also affected: SKUD/Module-InstalledVersion-0.05.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/c763c86e-27fe-11ee-862c-a7020965aee6

andk commented 10 months ago

Also affected: ATHREEF/App-adler32-0.001.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/131b1222-2803-11ee-a66e-530c0965aee6

andk commented 10 months ago

Also affected: RSAVAGE/Tree-1.15.tgz Sample fail report: http://www.cpantesters.org/cpan/report/d7f38f1e-280a-11ee-8abb-5e1d0965aee6 Note: only fails when Test::Memory::Cycle is installed, otherwise the sensitive test t/Tree/008_weak_refs.t is skipped

andk commented 10 months ago

Also affected: STRANGE/Locale-CLDR-Locales-Rof-v0.34.1.tar.gz, STRANGE/Locale-CLDR-Locales-Sg-v0.34.1.tar.gz, etc.

Test results look very similar to STRANGE/Locale-CLDR-Locales-Gd-v0.34.1.tar.gz, skipping reporting on further members of the Locale-CLDR-Locales family

haarg commented 9 months ago

Also affected: STRANGE/Locale-CLDR-Locales-Gd-v0.34.1.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/7c58c174-27fb-11ee-b708-a3f90865aee6

This is attempting to pass a test name to use ok, but it ends up being used as an import parameter.

Also affected: SKUD/Module-InstalledVersion-0.05.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/c763c86e-27fe-11ee-862c-a7020965aee6

This is the same, attempting to pass a test name to use_ok.

Also affected: ATHREEF/App-adler32-0.001.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/131b1222-2803-11ee-a66e-530c0965aee6

athreef/App-adler32#1

Also affected: RSAVAGE/Tree-1.15.tgz Sample fail report: http://www.cpantesters.org/cpan/report/d7f38f1e-280a-11ee-8abb-5e1d0965aee6 Note: only fails when Test::Memory::Cycle is installed, otherwise the sensitive test t/Tree/008_weak_refs.t is skipped

ronsavage/Tree#4

andk commented 9 months ago

Also affected: BMILLARES/POOF-1.4.tar.gz Fail report: http://www.cpantesters.org/cpan/report/ee0d400e-2811-11ee-86d3-be2c0965aee6

andk commented 9 months ago

Also affected: EXODIST/Devel-Declare-Parser-0.020.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/f15c5d74-27c8-11ee-937f-36ce116755ad @exodist please take note

andk commented 9 months ago

Also affected: RKRIMEN/Carp-Clan-Share-0.013.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/bb60b232-2823-11ee-95df-f0bd4dd32684 @robertkrimen please take note

rjbs commented 9 months ago

I released a fixed Sub::Exporter earlier today, using a patch from Yves.

demerphq commented 9 months ago

Also affected: EXODIST/Devel-Declare-Parser-0.020.tar.gz

@exodist use_ok() does not take a name as a second parameter, it feeds its arguments to the use statement. Patch provided as: https://github.com/exodist/Devel-Declare-Parser/pull/4

demerphq commented 9 months ago

Personally I am not going to investigate BMILLARES/POOF as it seems to have other breakage than caused by the UNIVERSAL::import change.

andk commented 9 months ago

Personally I am not going to investigate BMILLARES/POOF as it seems to have other breakage than caused by the UNIVERSAL::import change.

Bisect is verified. Bleadperl up to v5.39.0-115-g7c1600f081 passes its tests, v5.39.0-116-g2dcf3cf50d fails. XRef: https://rt.cpan.org/Ticket/Display.html?id=149099

demerphq commented 9 months ago

On Sat, 22 Jul 2023 at 10:30, andk @.***> wrote:

Personally I am not going to investigate BMILLARES/POOF as it seems to have other breakage than caused by the UNIVERSAL::import change.

Bisect is verified. Bleadperl up to v5.39.0-115-g7c1600f081 passes its tests, v5.39.0-116-g2dcf3cf50d fails. XRef: https://rt.cpan.org/Ticket/Display.html?id=149099

I was referring to the output:


Undefined value assigned to typeglob at
/tmp/loop_over_bdir-101935-CrkcWo/POOF-1.4-0/blib/lib/POOF.pm line
775.
Undefined value assigned to typeglob at
/tmp/loop_over_bdir-101935-CrkcWo/POOF-1.4-0/blib/lib/POOF.pm line
775.
Undefined value assigned to typeglob at
/tmp/loop_over_bdir-101935-CrkcWo/POOF-1.4-0/blib/lib/POOF.pm line
775.

Undefined value assigned to typeglob at
/tmp/loop_over_bdir-101935-CrkcWo/POOF-1.4-0/blib/lib/POOF.pm line 775.

Feel free to bisect when that started. IMO anything that warns like that is not being maintained. -- perl -Mre=debug -e "/just|another|perl|hacker/"

andk commented 9 months ago

Also affected: MITHALDU/Acme-MITHALDU-XSGrabBag-1.161310.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/097f5f94-287f-11ee-a756-6d284fd32684 @wchristian please take note

andk commented 9 months ago

Also affected: MIKER/Net-DNS-ToolKit-0.48.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/a00a4626-2885-11ee-877c-4d384fd32684

andk commented 9 months ago

Also affected: CLKAO/IO-Digest-0.11.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/cd02bec8-288b-11ee-8233-9d464fd32684 @clkao please take note

demerphq commented 9 months ago

Also affected: CLKAO/IO-Digest-0.11.tar.gz

https://github.com/clkao/IO-Digest/pull/7

cjg-cguevara commented 9 months ago

Also affected: Mouse http://fast-matrix.cpantesters.org/?dist=Mouse

demerphq commented 9 months ago

Also affected: Mouse

Rats! Not that one! I hate mice.

andk commented 9 months ago

Also affected: HADFL/Acme-Cow-0.2.tar.gz Sample fail report: http://www.cpantesters.org/cpan/report/c359e83a-28ac-11ee-ad87-f48e4fd32684