[packages/perl-IPC-SharedCache] - added wrap-IPC-ShareLite-new-calls-inside-eval-block patch from Debian - release 8

qboosh qboosh at pld-linux.org
Tue Jun 9 17:11:14 CEST 2015


commit d1b5ae2830e8feea295fc902750d30b259412113
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jun 9 17:12:28 2015 +0200

    - added wrap-IPC-ShareLite-new-calls-inside-eval-block patch from Debian
    - release 8

 ...IPC-ShareLite-new-calls-inside-eval-block.patch | 158 +++++++++++++++++++++
 perl-IPC-SharedCache.spec                          |   8 +-
 2 files changed, 163 insertions(+), 3 deletions(-)
---
diff --git a/perl-IPC-SharedCache.spec b/perl-IPC-SharedCache.spec
index 8a0d47f..a9e358d 100644
--- a/perl-IPC-SharedCache.spec
+++ b/perl-IPC-SharedCache.spec
@@ -9,11 +9,12 @@ Summary:	IPC::SharedCache - manage a cache in SysV IPC shared memory
 Summary(pl.UTF-8):	IPC::SharedCache - zarządzanie pamięcią podręczną w pamięci dzielonej SysV
 Name:		perl-IPC-SharedCache
 Version:	1.3
-Release:	7
+Release:	8
 License:	GPL v2+
 Group:		Development/Languages/Perl
-Source0:	http://www.cpan.org/modules/by-module/%{pdir}/%{pdir}-%{pnam}-%{version}.tar.gz
+Source0:	http://www.cpan.org/modules/by-module/IPC/%{pdir}-%{pnam}-%{version}.tar.gz
 # Source0-md5:	4d5d159a6b41d42918b7c1fceafb43ae
+Patch0:		%{name}-wrap-IPC-ShareLite-new-calls-inside-eval-block.patch
 URL:		http://search.cpan.org/dist/IPC-SharedCache/
 BuildRequires:	perl-Carp-Assert
 BuildRequires:	perl-IPC-ShareLite >= 0.06
@@ -32,6 +33,7 @@ hash.
 
 %prep
 %setup -q -n %{pdir}-%{pnam}-%{version}
+%patch0 -p1
 
 %build
 %{__perl} Makefile.PL \
@@ -53,4 +55,4 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc Changes ANNOUNCE
 %{perl_vendorlib}/IPC/SharedCache.pm
-%{_mandir}/man3/*.3pm*
+%{_mandir}/man3/IPC::SharedCache.3pm*
diff --git a/perl-IPC-SharedCache-wrap-IPC-ShareLite-new-calls-inside-eval-block.patch b/perl-IPC-SharedCache-wrap-IPC-ShareLite-new-calls-inside-eval-block.patch
new file mode 100644
index 0000000..251e1f1
--- /dev/null
+++ b/perl-IPC-SharedCache-wrap-IPC-ShareLite-new-calls-inside-eval-block.patch
@@ -0,0 +1,158 @@
+From 3bccbfe57c350b8db2a3f9d0812f6fa5548c7f2e Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Sun, 26 Apr 2009 23:07:03 +0300
+Subject: [PATCH] Wrap IPC::ShareLite->new() calls inside eval{} blocks.
+
+As of IPC::ShareLite 0.14, its constructor croaks on error where it used
+to return an empty value. This breaks the IPC::SharedCache test suite.
+
+http://bugs.debian.org/525711
+http://rt.cpan.org/Public/Bug/Display.html?id=45450
+---
+ SharedCache.pm |   36 +++++++++++++++++++++++++++---------
+ 1 files changed, 27 insertions(+), 9 deletions(-)
+
+diff --git a/SharedCache.pm b/SharedCache.pm
+index 30bca21..51eabcf 100644
+--- a/SharedCache.pm
++++ b/SharedCache.pm
+@@ -580,11 +580,13 @@ sub STORE {
+   my $share;
+   if (exists $root_record->{'map'}{$key}) {
+     # we've got a key, get the share and cache it
+-    $share = IPC::ShareLite->new('-key' => $root_record->{'map'}{$key},
++    $share = eval {
++             IPC::ShareLite->new('-key' => $root_record->{'map'}{$key},
+                                  '-mode' => $options->{ipc_mode},
+                                  '-size' => $options->{ipc_segment_size},
+                                  '-create' => 0,
+                                  '-destroy' => 0);
++    };
+     confess("IPC::SharedCache: Unable to get shared cache block $root_record->{'map'}{$key} : $!") unless defined $share;  
+ 
+     $root_record->{'size'} -= $root_record->{'length_map'}{$key};
+@@ -596,13 +598,15 @@ sub STORE {
+     for ( my $end = $obj_ipc_key + 10000 ; 
+           $obj_ipc_key != $end ; 
+           $obj_ipc_key++ ) {
+-      $share = IPC::ShareLite->new('-key' => $obj_ipc_key,
++      $share = eval {
++               IPC::ShareLite->new('-key' => $obj_ipc_key,
+                                    '-mode' => $options->{ipc_mode},
+                                    '-size' => $options->{ipc_segment_size},
+                                    '-create' => 1,
+                                    '-exclusive' => 1,
+                                    '-destroy' => 0,
+                                   );
++      };
+       last if defined $share;
+     }        
+     croak("IPC::SharedCache : searched through 10,000 consecutive locations for a free shared memory segment, giving up : $!")
+@@ -625,11 +629,13 @@ sub STORE {
+       my $delete_key = shift @{$root_record->{'queue'}};
+       # delete the segment for this object
+       { 
+-        my $share = IPC::ShareLite->new('-key' => $root_record->{map}{$delete_key},
++        my $share = eval {
++                    IPC::ShareLite->new('-key' => $root_record->{map}{$delete_key},
+                                         '-mode' => $options->{ipc_mode},
+                                         '-size' => $options->{ipc_segment_size},
+                                         '-create' => 0,
+                                     '-destroy' => 1);
++        };
+         confess("IPC::SharedCache: Unable to get shared cache block $root_record->{'map'}{$key} : $!") unless defined $share;
+         # share is now deleted since destroy == 1 and $share goes out of scope
+       }
+@@ -684,11 +690,13 @@ sub DELETE {
+ 
+   # delete the segment for this object
+   { 
+-    my $share = IPC::ShareLite->new('-key' => $obj_ipc_key,
++    my $share = eval {
++                IPC::ShareLite->new('-key' => $obj_ipc_key,
+                                     '-mode' => $options->{ipc_mode},
+                                     '-size' => $options->{ipc_segment_size},
+                                     '-create' => 0,
+                                     '-destroy' => 1);
++    };
+     confess("IPC::SharedCache: Unable to get shared cache block $root_record->{'map'}{$key} : $!") unless defined $share;
+     # share is now deleted since destroy == 1 and $share goes out of scope
+   }
+@@ -830,11 +838,13 @@ sub walk {
+   require "Data/Dumper.pm";
+   
+   # make sure the cache actually exists here
+-  my $test = IPC::ShareLite->new('-key' => $key,
++  my $test = eval {
++             IPC::ShareLite->new('-key' => $key,
+                                  '-mode' => 0666,
+                                  '-size' => $segment_size,
+                                  '-create' => 0, 
+                                  '-destroy' => 0);
++  };
+   die "Unable to find a cache at key $key : $!" unless defined $test;
+ 
+   my %self;
+@@ -911,10 +921,12 @@ sub remove {
+   
+   # delete the root segment
+   { 
+-    my $share = IPC::ShareLite->new('-key' => $key,
++    my $share = eval {
++                IPC::ShareLite->new('-key' => $key,
+                                     '-size' => $segment_size,
+                                     '-create' => 0,
+                                     '-destroy' => 1);
++    };
+     confess("IPC::SharedCache: Unable to get shared cache block $key : $!") unless defined $share;
+     # share is now deleted since destroy == 1 and $share goes out of scope
+   }
+@@ -938,11 +950,13 @@ sub _init_root {
+   return if defined $root;
+ 
+   # try to get a handle on an existing root for this key
+-  $root = IPC::ShareLite->new('-key' => $ipc_key,
++  $root = eval {
++          IPC::ShareLite->new('-key' => $ipc_key,
+                               '-mode' => $options->{ipc_mode},
+                               '-size' => $options->{ipc_segment_size},
+                               '-create' => 0, 
+                               '-destroy' => 0);
++  };
+   if (defined $root) {
+     $ROOT_SHARE_CACHE{$ipc_key} = $root;
+     return;
+@@ -961,12 +975,14 @@ sub _init_root {
+   #                           if $options->{debug};
+ 
+   # try to create it if that didn't work (and do initialization)
+-  $root = IPC::ShareLite->new('-key' => $options->{ipc_key},
++  $root = eval {
++          IPC::ShareLite->new('-key' => $options->{ipc_key},
+                               '-mode' => $options->{ipc_mode},
+                               '-size' => $options->{ipc_segment_size},
+                               '-create' => 1, 
+                               '-exclusive' => 1,
+                               '-destroy' => 0);
++  };
+   confess("IPC::SharedCache object initialization : Unable to initialize root ipc shared memory segment : $!") 
+     unless defined($root);
+ 
+@@ -1032,11 +1048,13 @@ sub _get_share_object {
+   my $options = $self->{options};
+ 
+   # we've got a key, get the share and cache it
+-  my $share = IPC::ShareLite->new('-key' => $obj_ipc_key,
++  my $share = eval {
++              IPC::ShareLite->new('-key' => $obj_ipc_key,
+                                   '-mode' => $options->{ipc_mode},
+                                   '-size' => $options->{ipc_segment_size},
+                                   '-create' => 0,
+                                   '-destroy' => 0);
++  };
+   confess("IPC::SharedCache: Unable to get shared cache block $obj_ipc_key : $!") unless defined $share;
+   
+   # get the cache block
+-- 
+1.6.2.4
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/perl-IPC-SharedCache.git/commitdiff/d1b5ae2830e8feea295fc902750d30b259412113



More information about the pld-cvs-commit mailing list