Skip Menu |

This queue is for tickets about the Archive-RPM CPAN distribution.

Report information
The Basics
Id: 120270
Status: new
Priority: 0/
Queue: Archive-RPM

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

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



Subject: Syntax error at inline delegation in Archive::RPM for _header
After upgrading Moose from 2.1807 to 2.2000, tests fails like this: PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t xt/*.t # Failed test 'use Archive::RPM;' # at t/00-load.t line 4. # Tried to use 'Archive::RPM'. # Error: Could not generate inline handles for _header->(<=> because : Failed to compile source: syntax error at inline delegation in Archive::RPM for _header->(<=> (attribute declared in /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm at line 68) line 18, near "<=>( " # # # source: # #line 1 "inline delegation in Archive::RPM for _header->(<=> (attribute declared in /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm at line 68)" # sub { # my $self = shift; # # my $proxy = $self->_header; # if ( !defined $proxy ) { # die Module::Runtime::use_module("Moose::Exception::AttributeValueIsNotDefined")->new(method => $self->meta->find_method_by_name("(<=>"), # instance => $self, # attribute => $self->meta->find_attribute_by_name("_header"), # ); # } # elsif ( ref $proxy && !Scalar::Util::blessed($proxy) ) { # die Module::Runtime::use_module("Moose::Exception::AttributeValueIsNotAnObject")->new(method => $self->meta->find_method_by_name("(<=>"), # instance => $self, # attribute => $self->meta->find_attribute_by_name("_header"), # given_value => $proxy, # ); # } # return $proxy->(<=>( @_ ); # } # at /usr/lib/perl5/vendor_perl/Class/MOP/Method/Generated.pm line 56. # at /usr/lib/perl5/vendor_perl/Moose/Meta/Method/Delegation.pm line 148 # Moose::Meta::Method::Delegation::catch {...} ('Failed to compile source: syntax error at inline delegation in Archive::RPM for _header->(<=> (attribute declared in /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm at line 68) line 18, near "<=>( "^J^J^Jsource:^J#line 1 "inline delegation in Archive::RPM for _header->(<=> (attribute declared in /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm at line 68)"^Jsub {^J my $self = shift;^J^J my $proxy = $self->_header;^J if ( !defined $proxy ) {^J die Module::Runtime::use_module("Moose::Exception::AttributeValueIsNotDefined")->new(method => $self->meta->find_method_by_name("(<=>"),^Jinstance => $self,^Jattribute => $self->meta->find_attribute_by_name("_header"),^J);^J }^J elsif ( ref $proxy && !Scalar::Util::blessed($proxy) ) {^J die Module::Runtime::use_module("Moose::Exception::AttributeValueIsNotAnObject")->new(method => $self->meta->find_method_by_name("(<=>"),^Jinstance => $self,^Jattribute => $self->meta->find_attribute_by_name("_header"),^Jgiven_value => $proxy,^J);^J }^J return $proxy->(<=>( @_ );^J}^J at /usr/lib/perl5/vendor_perl/Class/MOP/Method/Generated.pm line 56.^J') called at /usr/share/perl5/vendor_perl/Try/Tiny.pm line 124 # Try::Tiny::try('CODE(0xb785688)', 'Try::Tiny::Catch=REF(0xb7706b0)') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Method/Delegation.pm line 154 # Moose::Meta::Method::Delegation::_generate_inline_method('Moose::Meta::Method::Delegation=HASH(0xa149be0)') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Method/Delegation.pm line 82 # Moose::Meta::Method::Delegation::_initialize_body('Moose::Meta::Method::Delegation=HASH(0xa149be0)') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Method/Delegation.pm line 54 # Moose::Meta::Method::Delegation::new('Moose::Meta::Method::Delegation', 'name', '(<=>', 'package_name', 'Archive::RPM', 'attribute', 'Moose::Meta::Attribute=HASH(0xb774c68)', 'delegate_to_method', '(<=>', 'curried_arguments', 'ARRAY(0xa301c80)') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Attribute.pm line 1279 # Moose::Meta::Attribute::_make_delegation_method('Moose::Meta::Attribute=HASH(0xb774c68)', '(<=>', '(<=>') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Attribute.pm line 1146 # Moose::Meta::Attribute::install_delegation('Moose::Meta::Attribute=HASH(0xb774c68)') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Attribute.pm line 1015 # Moose::Meta::Attribute::install_accessors('Moose::Meta::Attribute=HASH(0xb774c68)') called at /usr/lib/perl5/vendor_perl/Class/MOP/Class.pm line 899 # Class::MOP::Class::try {...} at /usr/share/perl5/vendor_perl/Try/Tiny.pm line 103 # eval {...} at /usr/share/perl5/vendor_perl/Try/Tiny.pm line 94 # Try::Tiny::try('CODE(0xb7744b8)', 'Try::Tiny::Catch=REF(0xb7745d8)') called at /usr/lib/perl5/vendor_perl/Class/MOP/Class.pm line 904 # Class::MOP::Class::_post_add_attribute('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0xa4c52e0)', 'Moose::Meta::Attribute=HASH(0xb774c68)') called at /usr/lib/perl5/vendor_perl/Class/MOP/Mixin/HasAttributes.pm line 39 # Class::MOP::Mixin::HasAttributes::add_attribute('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0xa4c52e0)', 'Moose::Meta::Attribute=HASH(0xb774c68)') called at /usr/lib/perl5/vendor_perl/Moose/Meta/Class.pm line 583 # Moose::Meta::Class::add_attribute('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0xa4c52e0)', '_header', 'definition_context', 'HASH(0xb7742c8)', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0xa3e59c0)') called at /usr/lib/perl5/vendor_perl/Moose.pm line 74 # Moose::has('Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0xa4c52e0)', '_header', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0xa3e59c0)') called at /usr/lib/perl5/vendor_perl/Moose/Exporter.pm line 419 # Moose::has('_header', 'is', 'ro', 'isa', 'RPM2::Header', 'lazy_build', 1, 'handles', 'Regexp=REGEXP(0xa3e59c0)') called at /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 68 # require Archive/RPM.pm at t/00-load.t line 4 # main::BEGIN at /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 0 # eval {...} at /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 0 # eval 'package main; # BEGIN { ${^WARNING_BITS} = $args[-1] if defined $args[-1] } # #line 4 t/00-load.t # use Archive::RPM @{$args[0]}; # 1; # ' at /usr/share/perl5/vendor_perl/Test/More.pm line 1032 # Test::More::_eval('package main;^JBEGIN { ${^WARNING_BITS} = $args[-1] if defined $args[-1] }^J#line 4 t/00-load.t^Juse Archive::RPM @{$args[0]};^J1;^J', 'ARRAY(0x9d0a190)', undef) called at /usr/share/perl5/vendor_perl/Test/More.pm line 1007 # Test::More::use_ok('Archive::RPM') called at t/00-load.t line 4 # main::BEGIN at /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 0 # eval {...} at /builddir/build/BUILD/Archive-RPM-0.07/blib/lib/Archive/RPM.pm line 0 # Compilation failed in require at t/00-load.t line 4, <DATA> line 1. # BEGIN failed--compilation aborted at t/00-load.t line 4, <DATA> line 1. # Testing Archive::RPM 0.07, Perl 5.024001, /usr/bin/perl # Looks like you failed 1 test of 1. t/00-load.t ........... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests
From: ppisar [...] redhat.com
Dne Čt 16.úno.2017 03:42:29, ppisar napsal(a): Show quoted text
> After upgrading Moose from 2.1807 to 2.2000, tests fails
This happens since Moose-2.1900, from this commit exactly: commit 2eaa1f0ec0f826d77e0160c9f4f55b426c9d12f8 Author: Dave Rolsky <autarch@urth.org> Date: Thu Nov 27 13:57:26 2014 -0600 Generate inline version of delegations when possible It's triggered by this "handles" option: has _header => ( is => 'ro', isa => 'RPM2::Header', lazy_build => 1, # http://www.perlmonks.org/?node_id=588315 kick ass! handles => qr/^(?!(?s:.*)^(files|changelog|nvr)$)/, );
From: ppisar [...] redhat.com
Dne Čt 16.úno.2017 03:42:29, ppisar napsal(a): Show quoted text
> # Error: Could not generate inline handles for _header->(<=>
This looks like the same issue in DBIx-Class-Graph discussed in <https://rt.cpan.org/Public/Bug/Display.html?id=118808>. The problem is Archive::RPM delegates to RPM2::Header methods and RPM2::Header overloads '<=>': package RPM2::Header; our $VERSION = $RPM2::VERSION; use overload '<=>' => \&op_spaceship, 'cmp' => \&op_spaceship, 'bool' => \&op_bool; therefore Moose thinks there is '<=>' method which is the one reported in the test failure.
From: ppisar [...] redhat.com
Dne Čt 16.úno.2017 05:16:43, ppisar napsal(a): Show quoted text
> This looks like the same issue in DBIx-Class-Graph discussed in > <https://rt.cpan.org/Public/Bug/Display.html?id=118808>. >
Fix written the same way is attached.
Subject: Archive-RPM-0.07-Adjust-to-Moose-2.1900.patch
From 2e8b14b7f07f6a37711bbbd16b313768696fcc14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Thu, 16 Feb 2017 11:43:10 +0100 Subject: [PATCH] Adjust to Moose-2.1900 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Archive::RPM failed to compile since Moose-2.1900 because new Moose inlines delegation and that does work nice with overloaded '<=>' operator provided by RPM2::Header. This patch reimplements the handles option by code reference that can cope with it in contrast to regular expression. <https://rt.cpan.org/Public/Bug/Display.html?id=120270> <https://rt.cpan.org/Public/Bug/Display.html?id=118808> Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/Archive/RPM.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Archive/RPM.pm b/lib/Archive/RPM.pm index 913ce8c..548679c 100644 --- a/lib/Archive/RPM.pm +++ b/lib/Archive/RPM.pm @@ -70,8 +70,14 @@ has _header => ( isa => 'RPM2::Header', lazy_build => 1, - # http://www.perlmonks.org/?node_id=588315 kick ass! - handles => qr/^(?!(?s:.*)^(files|changelog|nvr)$)/, + handles => sub { + return map { $_ => $_ } + grep { $_ ne 'files' && $_ ne 'changelog' && $_ ne 'nvr' && + # Skip overloaded operators like '<=>' that blast Moose-2.1900 + # https://rt.cpan.org/Public/Bug/Display.html?id=120270 + $_ =~ /^[a-zA-Z]/ + } $_[1]->get_all_method_names; + }, ); sub _build__header { RPM2->open_package(shift->rpm) } -- 2.7.4