[perl-Devel-FindRef] Fix rhbz#815073
Nicolas Chauvet
kwizart at fedoraproject.org
Sun Apr 22 11:48:52 UTC 2012
commit fcfdefc9097ffbcda0b2b64e8b24b4c874ba7310
Author: Nicolas Chauvet <kwizart at gmail.com>
Date: Sun Apr 22 13:48:14 2012 +0200
Fix rhbz#815073
0001-Fix-64-bit-warnings.patch | 48 +++++++++++++++++++++++
0001-Fix-compiler-warnings.patch | 78 ++++++++++++++++++++++++++++++++++++++
perl-Devel-FindRef.spec | 10 ++++-
3 files changed, 134 insertions(+), 2 deletions(-)
---
diff --git a/0001-Fix-64-bit-warnings.patch b/0001-Fix-64-bit-warnings.patch
new file mode 100644
index 0000000..4d354da
--- /dev/null
+++ b/0001-Fix-64-bit-warnings.patch
@@ -0,0 +1,48 @@
+From 0e50780282bbe7cb56ca432657c965f064ee9cf2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 1 Feb 2012 10:40:07 +0100
+Subject: [PATCH] Fix 64-bit warnings
+
+---
+ FindRef.xs | 15 ++++++++++-----
+ 1 files changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/FindRef.xs b/FindRef.xs
+index 679958b..94920f6 100644
+--- a/FindRef.xs
++++ b/FindRef.xs
+@@ -151,7 +151,8 @@ find_ (SV *target_ref)
+ {
+ STRLEN length;
+ char *name = HePV(he, length);
+- res_pair (form ("the member '%.*s' of", length, name));
++ int ilength = length;
++ res_pair (form ("the member '%.*s' of", ilength, name));
+ }
+ }
+
+@@ -239,13 +240,17 @@ find_ (SV *target_ref)
+ MAGIC *mg = mg_find (sv, PERL_MAGIC_defelem);
+
+ if (mg && mg->mg_obj)
+- res_pair (form ("the target for the lvalue hash element '%.*s',",
+- SvCUR (mg->mg_obj), SvPV_nolen (mg->mg_obj)));
++ {
++ STRLEN length = SvCUR (mg->mg_obj);
++ int ilength = length;
++ res_pair (form ("the target for the lvalue hash element '%.*s',",
++ ilength, SvPV_nolen (mg->mg_obj)));
++ }
+ else
+- res_pair (form ("the target for the lvalue array element #%d,", LvTARGOFF (sv)));
++ res_pair (form ("the target for the lvalue array element #%zu,", LvTARGOFF (sv)));
+ }
+ else
+- res_pair (form ("an lvalue reference target (type '%c', ofs %d, len %d),",
++ res_pair (form ("an lvalue reference target (type '%c', ofs %zu, len %zu),",
+ LvTYPE (sv), LvTARGOFF (sv), LvTARGLEN (sv)));
+ }
+
+--
+1.7.7.6
+
diff --git a/0001-Fix-compiler-warnings.patch b/0001-Fix-compiler-warnings.patch
new file mode 100644
index 0000000..9cc7347
--- /dev/null
+++ b/0001-Fix-compiler-warnings.patch
@@ -0,0 +1,78 @@
+From 518eb9d008bc9f001fe6d46d830617325a41d67f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 1 Feb 2012 10:24:10 +0100
+Subject: [PATCH] Fix compiler warnings
+
+See <https://bugzilla.redhat.com/show_bug.cgi?id=786085>.
+---
+ FindRef.xs | 40 ++++++++++++++++++++++++++--------------
+ 1 files changed, 26 insertions(+), 14 deletions(-)
+
+diff --git a/FindRef.xs b/FindRef.xs
+index ea7c692..679958b 100644
+--- a/FindRef.xs
++++ b/FindRef.xs
+@@ -39,10 +39,13 @@
+ } while (0)
+
+ #define res_gv(sigil) \
+- res_text (form ("the global %c%s::%.*s", sigil, \
+- HvNAME (GvSTASH (sv)), \
+- GvNAME_HEK (sv) ? GvNAMELEN (sv) : 11, \
+- GvNAME_HEK (sv) ? GvNAME (sv) : "<anonymous>"))
++ do { \
++ int32_t length = GvNAME_HEK (sv) ? GvNAMELEN (sv) : 11; \
++ res_text (form ("the global %c%s::%.*s", sigil, \
++ HvNAME (GvSTASH (sv)), \
++ length, \
++ GvNAME_HEK (sv) ? GvNAME (sv) : "<anonymous>")); \
++ } while (0)
+
+ MODULE = Devel::FindRef PACKAGE = Devel::FindRef
+
+@@ -145,7 +148,11 @@ find_ (SV *target_ref)
+
+ while ((he = hv_iternext ((HV *)sv)))
+ if (HeVAL (he) == targ)
+- res_pair (form ("the member '%.*s' of", HeKLEN (he), HeKEY (he)));
++ {
++ STRLEN length;
++ char *name = HePV(he, length);
++ res_pair (form ("the member '%.*s' of", length, name));
++ }
+ }
+
+ break;
+@@ -195,15 +202,20 @@ find_ (SV *target_ref)
+ res_pair ("the containing scope for");
+
+ if (sv == targ && CvANON (sv))
+- if (CvSTART (sv)
+- && CvSTART (sv)->op_type == OP_NEXTSTATE
+- && CopLINE ((COP *)CvSTART (sv)))
+- res_text (form ("the closure created at %s:%d",
+- CopFILE ((COP *)CvSTART (sv)) ? CopFILE ((COP *)CvSTART (sv)) : "<unknown>",
+- CopLINE ((COP *)CvSTART (sv))));
+- else
+- res_text (form ("the closure created somewhere in file %s (PLEASE REPORT!)",
+- CvFILE (sv) ? CvFILE (sv) : "<unknown>"));
++ {
++ if (CvSTART (sv)
++ && CvSTART (sv)->op_type == OP_NEXTSTATE
++ && CopLINE ((COP *)CvSTART (sv)))
++ {
++ uint32_t line = CopLINE ((COP *)CvSTART (sv));
++ res_text (form ("the closure created at %s:%"PRIu32,
++ CopFILE ((COP *)CvSTART (sv)) ? CopFILE ((COP *)CvSTART (sv)) : "<unknown>",
++ line));
++ }
++ else
++ res_text (form ("the closure created somewhere in file %s (PLEASE REPORT!)",
++ CvFILE (sv) ? CvFILE (sv) : "<unknown>"));
++ }
+ }
+
+ break;
+--
+1.7.7.6
+
diff --git a/perl-Devel-FindRef.spec b/perl-Devel-FindRef.spec
index 30b2a5f..7b6a990 100644
--- a/perl-Devel-FindRef.spec
+++ b/perl-Devel-FindRef.spec
@@ -1,11 +1,13 @@
Name: perl-Devel-FindRef
Version: 1.42
-Release: 14%{?dist}
+Release: 15%{?dist}
Summary: Where is that reference to my variable hiding?
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/Devel-FindRef/
Source0: http://www.cpan.org/authors/id/M/ML/MLEHMANN/Devel-FindRef-%{version}2.tar.gz
+Patch0: 0001-Fix-compiler-warnings.patch
+Patch1: 0001-Fix-64-bit-warnings.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(common::sense)
@@ -19,7 +21,8 @@ references "backwards" is usually possible.
%prep
%setup -q -n Devel-FindRef-%{version}2
-
+%patch0 -p1
+%patch1 -p1
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"
@@ -50,6 +53,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/Devel*.3*
%changelog
+* Sun Apr 22 2012 Nicolas Chauvet <kwizart at gmail.com> - 1.42-15
+- Fix rhbz#815073 - Segfault in XS_Devel__FindRef_find_()
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.42-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list