Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The --archive option to prove seems to be broken #42

Closed
MagnusEnger opened this issue Sep 30, 2014 · 15 comments
Closed

The --archive option to prove seems to be broken #42

MagnusEnger opened this issue Sep 30, 2014 · 15 comments

Comments

@MagnusEnger
Copy link

Thanks for creating and maintaining some great modules!

After some recent upgrades, the --archive option to prove seems to be broken:

$ prove --archive /tmp/test.tgz
Can't locate object method "new" via package "TAP::Harness::Archive::SUPER" at /usr/local/share/perl/5.14.2/TAP/Harness/Archive.pm line 96.

Line 96 looks like this:

my $self = $class->SUPER::new($args);

Versions:
OS: Debian 7.6
Perl: v5.14.2 built for x86_64-linux-gnu-thread-multi
TAP::Harness 3.33
TAP::Harness::Archive 0.15

I have tested this with TAP::Harness::Archive 0.15 and TAP::Harness 3.23, and that seems to work. Not quite sure if this is mainly a problem with TAP::Harness or TAP::Harness::Archive...

Please let me know if more details are needed.

@Leont
Copy link
Member

Leont commented Oct 1, 2014

I can't reproduce this.

@MagnusEnger
Copy link
Author

I just tested it again, on a fresh Debian 7.6 Virtualbox.

First I tested with TAP::Harness and TAP::Harness::Archive installed from Debian packages, and it worked. This was:
TAP::Harness::Archive = version 0.14
TAP::Harness = version 3.23

Then I installed TAP::Harness::Archive from CPAN, and it still worked. Now I had:
TAP::Harness::Archive = version 0.15
TAP::Harness = version 3.23

Then I installed TAP::Harness from CPAN too, and it did not work. Now I have:
TAP::Harness::Archive = version 0.15
TAP::Harness = version 3.33

The error is:
Can't locate object method "new" via package "TAP::Harness::Archive::SUPER" at /usr/local/share/perl/5.14.2/TAP/Harness/Archive.pm line 96.

Perl version:
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi

@mohawk2
Copy link
Member

mohawk2 commented Oct 13, 2014

Could you provide a shell snippet that will create test.tgz? (Effectively, a shar file)

@jkeenan
Copy link

jkeenan commented Oct 13, 2014

I could not reproduce this failure with TAP::Harness::Archive v0.15 and either perl-5.20.1 or perl-5.14.4 (both installed via 'perlbrew').

I tested this by turning to my local git checkout of my most recent CPAN distribution, Git-Reduce-Tests. With each version of Perl, I called:

$ perl Makefile.PL
$ make
$ prove -vb --archive /home/jkeenan/tmp/grt/git-reduce-tests.tgz xt/git/*.t

In each case, I changed to the output directory and called:

$ tar xzvf git-reduce-tests.tgz

... which yielded:

$ find . -type f -a ! -name '*tgz'
./meta.yml
./xt/git/002-prepare-reduced-branch.t
./xt/git/001-new.t

I inspected the files and saw that their content was plausible.

Thank you very much.
Jim Keenan

@MagnusEnger
Copy link
Author

jkeenan: which version of TAP::Harness?

@jkeenan
Copy link

jkeenan commented Oct 18, 2014

As stated in previous post: I could not reproduce this failure with TAP::Harness::Archive v0.15 and either perl-5.20.1 or perl-5.14.4 (both installed via 'perlbrew'). TAP::Harness v3.30 in the case of perl-5.20.1 and perl-5.14.4.

@MagnusEnger
Copy link
Author

But TAP::Harness::Archive and TAP::Harness are two separate modules. For me, it looks like TAP::Harness is the one that is causing the trouble. --archive works with either TAP::Harness::Archive 0.14 or 0.15, but only as long as TAP::Harness is 3.23. When I upgrade that to 3.33 it breaks.

@jkeenan
Copy link

jkeenan commented Oct 18, 2014

Using 'cpanm', I upgraded to TAP-Harness v3.33. I repeated the procedures described in my previous post with perl-5.20.1. A tarball was created. I unpacked that tarball. All the contents were plausible.

However, when I then said 'perlbrew switch perl-5.14.4' and repeated the procedures, I got:

$ perl -v | head -2 | tail -1
This is perl 5, version 14, subversion 4 (v5.14.4) built for x86_64-linux

$ prove -vb --archive /home/jkeenan/tmp/grt/git-reduce-tests.tgz xt/git/*.t
Can't locate object method "new" via package "TAP::Harness::Archive::SUPER" 
   at /home/jkeenan/perl5/lib/perl5/TAP/Harness/Archive.pm line 96.

So there is some problematic interaction between TAP::Harness v3.33 and older perls.

@MagnusEnger
Copy link
Author

Sorry for dragging on... Did you mean 3.23 or 3.33? 3.23 works for me, 3.33 does not.

@miyagawa
Copy link
Member

Reproduced with perl 5.14.4. Failure with TAP::Harness 3.33 but not 3.23.

The key here is the base.pm 2.16 that ships with perl 5.14.4.

base.pm is known to be buggy and it previously skipped requiring modules when it's needed in case of cyclic invocations, and this "TAP::Harness requiring TAP::Harness::Archive which calls use base on TAP::Harness" falls on that.

base.pm 2.18 apparently fixed it:

    - base no longer internally skips loading modules it has already
      loaded and instead relies on require to inspect %INC.

But Test::Harness has a reason to switch from parent.pm to base.pm (can't use non-core prereq since it might cause cyclic dependencies). And requiring newer base.pm might have the same problem.

I guess the last resort is to use @ISA, or bundle its own base.pm. 😭

@miyagawa
Copy link
Member

Actually - since TAP::Harness::Archive is a standalone module, could it be just updated to require parent instead? I confirmed it works if i change use base to use parent in Archive.pm. Still might not be ideal, but at least Test::Harness doesn't need to deal with it.

@MagnusEnger
Copy link
Author

Thanks for looking into this. Good to know it's not just me going crazy... :-) As for the technical stuff, that is way above my head, I'm afraid.

@Leont
Copy link
Member

Leont commented Oct 20, 2014

The key here is the base.pm 2.16 that ships with perl 5.14.4.

base.pm is known to be buggy and it previously skipped requiring modules when it's needed in case of cyclic invocations, and this "TAP::Harness requiring TAP::Harness::Archive which calls use base on TAP::Harness" falls on that.

I don't quite understand. TAP::Harness doesn't load TAP::Harness::Archive during compile-time, so the circularity shouldn't be a problem, right?

@Leont
Copy link
Member

Leont commented Oct 20, 2014

Actually - since TAP::Harness::Archive is a standalone module, could it be just updated to require parent instead?

Sounds like a reasonable workaround to me.

@miyagawa
Copy link
Member

I don't quite understand. TAP::Harness doesn't load TAP::Harness::Archive during compile-time, so the circularity shouldn't be a problem, right?

Yeah it's weird, but certainly, TAP::Harness::Archive skips requiring TAP::Harness as well as pushing it into @ISA when using base.pm 2.16. I'm not sure if it is a particular bug in 2.16, but it is definitely fixed in 2.18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants