[perl-Cache-Mmap] Resolves: BZ#1135969

Jitka Plesnikova jplesnik at fedoraproject.org
Thu Sep 4 14:36:31 UTC 2014


commit 20bb37c40610d0cea8330c7ccfeca37ab85a3f7f
Author: Jitka Plesnikova <jplesnik at redhat.com>
Date:   Thu Sep 4 16:36:20 2014 +0200

    Resolves: BZ#1135969

 ...oid-Copy-On-Write-problems-with-Perl-5.20.patch |   39 ++++++++++++++++++++
 perl-Cache-Mmap.spec                               |    4 ++
 2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/Cache-Mmap-0.11-Avoid-Copy-On-Write-problems-with-Perl-5.20.patch b/Cache-Mmap-0.11-Avoid-Copy-On-Write-problems-with-Perl-5.20.patch
new file mode 100644
index 0000000..e1c9ed8
--- /dev/null
+++ b/Cache-Mmap-0.11-Avoid-Copy-On-Write-problems-with-Perl-5.20.patch
@@ -0,0 +1,39 @@
+>From 610a7fd5092921cc317d77eedf626b2c62ca4a38 Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Mon, 28 Jul 2014 00:15:11 +0300
+Subject: [PATCH] Avoid Copy-On-Write problems with Perl 5.20
+
+Quoting Dave Mitchell in https://rt.cpan.org/Public/Bug/Display.html?id=95940
+
+  After FC's commit, $buf gets marked as COW, since its a copy of a
+  COWable constant (the constant string "") and mmap() never unsets this
+  flag before stealing its buffer. So later on when it applies substr()
+  to $buf, the var is assumed to be COW and bad things happen to it.
+
+  The correct usage is still up for debate (see Leon's use case in
+  rt.perl.org tickets #116407 and #116925), but calling SvPV_force()
+  first would be a good first step (although that will cause the previous
+  contents of PVX() to leak). It might be better for Mmap.pm to call mmap()
+  with an undef value rather than assigning "" to it first.
+
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=95940
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750226
+---
+ Mmap.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Mmap.pm b/Mmap.pm
+index c3501b1..21925e9 100644
+--- a/Mmap.pm
++++ b/Mmap.pm
+@@ -823,7 +823,7 @@ sub _set_options{
+     # mmap() isn't supposed to work on locked files, so unlock
+     $self->_unlock;
+ 
+-    mmap($self->{_mmap}='',$size,$self->{_fh})
++    mmap($self->{_mmap}=undef,$size,$self->{_fh})
+       or do{
+ 	delete $self->{_mmap};
+ 	croak "Can't mmap $self->{_filename}: $!";
+-- 
+2.0.1
diff --git a/perl-Cache-Mmap.spec b/perl-Cache-Mmap.spec
index 9ca5932..ef7bf90 100644
--- a/perl-Cache-Mmap.spec
+++ b/perl-Cache-Mmap.spec
@@ -6,6 +6,8 @@ License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Cache-Mmap/
 Source0:        http://www.cpan.org/authors/id/P/PM/PMH/Cache-Mmap-%{version}.tar.gz
+# Fixed BZ#1135969, RT#95940
+Patch0:         Cache-Mmap-0.11-Avoid-Copy-On-Write-problems-with-Perl-5.20.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  perl(ExtUtils::MakeMaker)
 BuildRequires:  perl(Test::More)
@@ -19,6 +21,7 @@ of refreshing cache contents, and updating underlying data, if necessary.
 
 %prep
 %setup -q -n Cache-Mmap-%{version}
+%patch0 -p1
 chmod a-x cmmtest
 
 %build
@@ -52,6 +55,7 @@ rm -rf $RPM_BUILD_ROOT
 %changelog
 * Thu Aug 28 2014 Jitka Plesnikova <jplesnik at redhat.com> - 0.11-18
 - Perl 5.20 rebuild
+- Resolves: BZ#1135969
 
 * Sun Aug 17 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.11-17
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild


More information about the scm-commits mailing list