ppisar pushed to perl-Mouse (master). "Fix interaction with threads in perl-5.22"
notifications at fedoraproject.org
notifications at fedoraproject.org
Fri Jun 26 07:24:55 UTC 2015
From cf5f6d8e749f9104e0fc0648bd78d721bffd2737 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Fri, 26 Jun 2015 09:09:19 +0200
Subject: Fix interaction with threads in perl-5.22
diff --git a/Mouse-2.4.2-Fix-test-code.patch b/Mouse-2.4.2-Fix-test-code.patch
new file mode 100644
index 0000000..142aedb
--- /dev/null
+++ b/Mouse-2.4.2-Fix-test-code.patch
@@ -0,0 +1,39 @@
+From 43bd48014c89331cc0dadad78190890199469e81 Mon Sep 17 00:00:00 2001
+From: Syohei YOSHIDA <syohex at gmail.com>
+Date: Wed, 24 Jun 2015 18:02:57 +0900
+Subject: [PATCH 2/2] Fix test code
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In original code, mismatching plan error is occurred.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ t/900_mouse_bugs/017_issue29.t | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/t/900_mouse_bugs/017_issue29.t b/t/900_mouse_bugs/017_issue29.t
+index 14c2900..bc93767 100644
+--- a/t/900_mouse_bugs/017_issue29.t
++++ b/t/900_mouse_bugs/017_issue29.t
+@@ -3,10 +3,13 @@
+ package main;
+ use strict;
+ use warnings;
+-use Test::More skip_all => 'See https://github.com/gfx/p5-Mouse/issues/29';
+-
+-use Test::Requires qw(threads); # XXX: ithreads is discuraged!
++use constant HAS_THREADS => eval{ require threads && require threads::shared };
++use Test::More;
+
++use if !HAS_THREADS, 'Test::More',
++ (skip_all => "This is a test for threads ($@)");
++use if $Test::More::VERSION >= 2.00, 'Test::More',
++ (skip_all => "Test::Builder2 has bugs about threads");
+
+ {
+ package Foo;
+--
+2.1.0
+
diff --git a/Mouse-2.4.2-Fix-thread-issue-for-Perl-5.22.0-or-higher.patch b/Mouse-2.4.2-Fix-thread-issue-for-Perl-5.22.0-or-higher.patch
new file mode 100644
index 0000000..f178e73
--- /dev/null
+++ b/Mouse-2.4.2-Fix-thread-issue-for-Perl-5.22.0-or-higher.patch
@@ -0,0 +1,195 @@
+From 40f345f8b69a863069b25c5f3aac22d8f677eb03 Mon Sep 17 00:00:00 2001
+From: Syohei YOSHIDA <syohex at gmail.com>
+Date: Wed, 24 Jun 2015 17:34:02 +0900
+Subject: [PATCH 1/2] Fix thread issue for Perl 5.22.0 or higher
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ mouse.h | 8 ++++++++
+ xs-src/MouseAccessor.xs | 20 ++++++++++++--------
+ xs-src/MouseTypeConstraints.xs | 17 +++++++++++------
+ 3 files changed, 31 insertions(+), 14 deletions(-)
+
+diff --git a/mouse.h b/mouse.h
+index b0c53ef..48792a2 100644
+--- a/mouse.h
++++ b/mouse.h
+@@ -106,6 +106,14 @@ SV* mouse_av_at_safe(pTHX_ AV* const mi, I32 const ix);
+ #define MOUSE_mg_slot(mg) MOUSE_mg_obj(mg)
+ #define MOUSE_mg_xa(mg) ((AV*)MOUSE_mg_ptr(mg))
+
++static inline MAGIC *MOUSE_get_magic(CV *cv, MGVTBL *vtbl)
++{
++#ifndef MULTIPLICITY
++ return (MAGIC*)(CvXSUBANY(cv).any_ptr);
++#else
++ return mg_findext((SV*)cv, PERL_MAGIC_ext, vtbl);
++#endif
++}
+
+ /* mouse_instance.xs stuff */
+ SV* mouse_instance_create (pTHX_ HV* const stash);
+diff --git a/xs-src/MouseAccessor.xs b/xs-src/MouseAccessor.xs
+index daf9cf1..11eb630 100644
+--- a/xs-src/MouseAccessor.xs
++++ b/xs-src/MouseAccessor.xs
+@@ -122,7 +122,9 @@ mouse_accessor_generate(pTHX_ SV* const attr, XSUBADDR_t const accessor_impl){
+ * although we use MAGIC for gc, we also store mg to
+ * CvXSUBANY for efficiency (gfx)
+ */
++#ifndef MULTIPLICITY
+ CvXSUBANY(xsub).any_ptr = (void*)mg;
++#endif
+
+ return xsub;
+ }
+@@ -262,7 +264,7 @@ XS(XS_Mouse_accessor)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- MAGIC* const mg = (MAGIC*)XSANY.any_ptr;
++ MAGIC* const mg = MOUSE_get_magic(cv, &mouse_accessor_vtbl);
+
+ SP -= items; /* PPCODE */
+ PUTBACK;
+@@ -285,7 +287,7 @@ XS(XS_Mouse_reader)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- MAGIC* const mg = (MAGIC*)XSANY.any_ptr;
++ MAGIC* const mg = MOUSE_get_magic(cv, &mouse_accessor_vtbl);
+
+ if (items != 1) {
+ mouse_throw_error(MOUSE_mg_attribute(mg), NULL,
+@@ -303,7 +305,7 @@ XS(XS_Mouse_writer)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- MAGIC* const mg = (MAGIC*)XSANY.any_ptr;
++ MAGIC* const mg = MOUSE_get_magic(cv, &mouse_accessor_vtbl);
+
+ if (items != 2) {
+ mouse_throw_error(MOUSE_mg_attribute(mg), NULL,
+@@ -351,7 +353,9 @@ mouse_simple_accessor_generate(pTHX_
+ * although we use MAGIC for gc, we also store mg to CvXSUBANY
+ * for efficiency (gfx)
+ */
++#ifndef MULTIPLICITY
+ CvXSUBANY(xsub).any_ptr = (void*)mg;
++#endif
+
+ return xsub;
+ }
+@@ -360,7 +364,7 @@ XS(XS_Mouse_simple_reader)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- MAGIC* const mg = (MAGIC*)XSANY.any_ptr;
++ MAGIC* const mg = MOUSE_get_magic(cv, &mouse_accessor_vtbl);
+ SV* value;
+
+ if (items != 1) {
+@@ -389,7 +393,7 @@ XS(XS_Mouse_simple_writer)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- SV* const slot = MOUSE_mg_slot((MAGIC*)XSANY.any_ptr);
++ SV* const slot = MOUSE_mg_slot(MOUSE_get_magic(cv, &mouse_accessor_vtbl));
+
+ if (items != 2) {
+ croak("Expected exactly two argument for a writer of %"SVf,
+@@ -404,7 +408,7 @@ XS(XS_Mouse_simple_clearer)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- SV* const slot = MOUSE_mg_slot((MAGIC*)XSANY.any_ptr);
++ SV* const slot = MOUSE_mg_slot(MOUSE_get_magic(cv, &mouse_accessor_vtbl));
+ SV* value;
+
+ if (items != 1) {
+@@ -421,7 +425,7 @@ XS(XS_Mouse_simple_predicate)
+ {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- SV* const slot = MOUSE_mg_slot((MAGIC*)XSANY.any_ptr);
++ SV* const slot = MOUSE_mg_slot(MOUSE_get_magic(cv, &mouse_accessor_vtbl));
+
+ if (items != 1) {
+ croak("Expected exactly one argument for a predicate of %"SVf, slot);
+@@ -435,7 +439,7 @@ XS(XS_Mouse_simple_predicate)
+ XS(XS_Mouse_inheritable_class_accessor) {
+ dVAR; dXSARGS;
+ dMOUSE_self;
+- SV* const slot = MOUSE_mg_slot((MAGIC*)XSANY.any_ptr);
++ SV* const slot = MOUSE_mg_slot(MOUSE_get_magic(cv, &mouse_accessor_vtbl));
+ SV* value;
+ HV* stash;
+
+diff --git a/xs-src/MouseTypeConstraints.xs b/xs-src/MouseTypeConstraints.xs
+index d4b57a0..6d723ee 100644
+--- a/xs-src/MouseTypeConstraints.xs
++++ b/xs-src/MouseTypeConstraints.xs
+@@ -24,6 +24,8 @@ typedef int (*check_fptr_t)(pTHX_ SV* const data, SV* const sv);
+ static
+ XSPROTO(XS_Mouse_constraint_check);
+
++static MGVTBL mouse_util_type_constraints_vtbl; /* not used, only for identity */
++
+ /*
+ NOTE: mouse_tc_check() handles GETMAGIC
+ */
+@@ -33,9 +35,10 @@ mouse_tc_check(pTHX_ SV* const tc_code, SV* const sv) {
+ assert(SvTYPE(cv) == SVt_PVCV);
+
+ if(CvXSUB(cv) == XS_Mouse_constraint_check){ /* built-in type constraints */
+- MAGIC* const mg = (MAGIC*)CvXSUBANY(cv).any_ptr;
+-
++ MAGIC* const mg = MOUSE_get_magic(cv, &mouse_util_type_constraints_vtbl);
++#ifndef MULTIPLICITY
+ assert(CvXSUBANY(cv).any_ptr != NULL);
++#endif
+ assert(mg->mg_ptr != NULL);
+
+ SvGETMAGIC(sv);
+@@ -498,14 +501,13 @@ mouse_can_methods(pTHX_ AV* const methods, SV* const instance){
+ return FALSE;
+ }
+
+-static MGVTBL mouse_util_type_constraints_vtbl; /* not used, only for identity */
+-
+ static CV*
+ mouse_tc_generate(pTHX_ const char* const name, check_fptr_t const fptr, SV* const param) {
+ CV* xsub;
++ MAGIC* mg;
+
+ xsub = newXS(name, XS_Mouse_constraint_check, __FILE__);
+- CvXSUBANY(xsub).any_ptr = sv_magicext(
++ mg = sv_magicext(
+ (SV*)xsub,
+ param, /* mg_obj: refcnt will be increased */
+ PERL_MAGIC_ext,
+@@ -513,6 +515,9 @@ mouse_tc_generate(pTHX_ const char* const name, check_fptr_t const fptr, SV* con
+ (char*)fptr, /* mg_ptr */
+ 0 /* mg_len: 0 for static data */
+ );
++#ifndef MULTIPLICITY
++ CvXSUBANY(xsub).any_ptr = (void*)mg;
++#endif
+
+ if(!name){
+ sv_2mortal((SV*)xsub);
+@@ -569,7 +574,7 @@ static
+ XSPROTO(XS_Mouse_constraint_check) {
+ dVAR;
+ dXSARGS;
+- MAGIC* const mg = (MAGIC*)XSANY.any_ptr;
++ MAGIC* const mg = MOUSE_get_magic(cv, &mouse_util_type_constraints_vtbl);
+ SV* sv;
+
+ if(items < 1){
+--
+2.1.0
+
diff --git a/perl-Mouse.spec b/perl-Mouse.spec
index 22e13a7..47b63f5 100644
--- a/perl-Mouse.spec
+++ b/perl-Mouse.spec
@@ -1,7 +1,7 @@
Name: perl-Mouse
Summary: Moose minus the antlers
Version: 2.4.2
-Release: 4%{?dist}
+Release: 5%{?dist}
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/Mouse
@@ -9,6 +9,12 @@ Source0: http://search.cpan.org/CPAN/authors/id/G/GF/GFUJI/Mouse-%{versio
# The build of Data::Dump::Streamer fails with 5.21.x and higher
# Disable the optional test to build Mouse with Perl 5.22
Patch0: Mouse-2.4.2-Disable-using-Data-Dump-Streamer.patch
+# Fix interaction with threads in perl-5.22, not compatible with older perls,
+# bug #1235938, <https://github.com/gfx/p5-Mouse/pull/50>
+Patch1: Mouse-2.4.2-Fix-thread-issue-for-Perl-5.22.0-or-higher.patch
+# Enable and correct threads test, not compatible with older perls,
+# bug #1235938, <https://github.com/gfx/p5-Mouse/pull/50>
+Patch2: Mouse-2.4.2-Fix-test-code.patch
# Module Build
BuildRequires: perl
BuildRequires: perl(Devel::PPPort) >= 3.19
@@ -106,6 +112,8 @@ an experimental first release, so comments and suggestions are very welcome.
%setup -q -n Mouse-%{version}
%if 0%(perl -e 'print $] >= 5.022')
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%endif
# Fix permissions
@@ -169,6 +177,9 @@ find %{buildroot} -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
%{_mandir}/man3/Test::Mouse.3*
%changelog
+* Fri Jun 26 2015 Petr Pisar <ppisar at redhat.com> - 2.4.2-5
+- Fix interaction with threads in perl-5.22 (bug #1235938)
+
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.4.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/perl-Mouse.git/commit/?h=master&id=cf5f6d8e749f9104e0fc0648bd78d721bffd2737
More information about the perl-devel
mailing list