From cdb096ba56cb43f37c8d668fdc4534afc46df206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com> Date: Mon, 16 May 2016 12:57:24 +0200 Subject: 1.838 bump
--- .gitignore | 1 + ...File-objects-only-from-original-thread-co.patch | 180 --------------------- ...File-objects-only-from-original-thread-co.patch | 180 +++++++++++++++++++++ perl-DB_File.spec | 15 +- sources | 2 +- 5 files changed, 193 insertions(+), 185 deletions(-) delete mode 100644 DB_File-1.833-Destroy-DB_File-objects-only-from-original-thread-co.patch create mode 100644 DB_File-1.838-Destroy-DB_File-objects-only-from-original-thread-co.patch diff --git a/.gitignore b/.gitignore index 885621d..1ef64fc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /DB_File-1.833.tar.gz /DB_File-1.834.tar.gz /DB_File-1.835.tar.gz +/DB_File-1.838.tar.gz diff --git a/DB_File-1.833-Destroy-DB_File-objects-only-from-original-thread-co.patch b/DB_File-1.833-Destroy-DB_File-objects-only-from-original-thread-co.patch deleted file mode 100644 index 895bc8f..0000000 --- a/DB_File-1.833-Destroy-DB_File-objects-only-from-original-thread-co.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 6d488944a7b5f5342bd249c7fe045df79779ed8e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com> -Date: Tue, 10 Jun 2014 14:28:09 +0200 -Subject: [PATCH] Destroy DB_File objects only from original thread context -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This patch fixes a crash when destroing a hash tied to a DB_File -database after spawning a thread: - -use Fcntl; -use DB_File; -use threads; -tie(my %dbtest, 'DB_File', "test.db", O_RDWR|O_CREAT, 0666); -threads->new(sub {})->join; - -This crashed or paniced depending on how perl was configured. - -Closes RT#61912. - -Signed-off-by: Petr Písař <ppi...@redhat.com> ---- - DB_File.xs | 50 +++++++++++++++++++++++++++++++------------------- - MANIFEST | 1 + - t/db-threads.t | 46 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 78 insertions(+), 19 deletions(-) - create mode 100644 t/db-threads.t - -diff --git a/DB_File.xs b/DB_File.xs -index d060dcb..83d77ea 100755 ---- a/DB_File.xs -+++ b/DB_File.xs -@@ -407,6 +407,7 @@ typedef union INFO { - - typedef struct { - DBTYPE type ; -+ tTHX owner ; - DB * dbp ; - SV * compare ; - bool in_compare ; -@@ -1007,6 +1008,7 @@ SV * sv ; - name, flags, mode, sv == NULL) ; - #endif - Zero(RETVAL, 1, DB_File_type) ; -+ RETVAL->owner = aTHX; - - /* Default to HASH */ - RETVAL->filtering = 0 ; -@@ -1279,6 +1281,7 @@ SV * sv ; - - /* printf("In ParseOpenInfo name=[%s] flags=[%d] mode = [%d]\n", name, flags, mode) ; */ - Zero(RETVAL, 1, DB_File_type) ; -+ RETVAL->owner = aTHX; - - /* Default to HASH */ - RETVAL->filtering = 0 ; -@@ -1598,27 +1601,36 @@ db_DESTROY(db) - INIT: - CurrentDB = db ; - Trace(("DESTROY %p\n", db)); -- CLEANUP: -- Trace(("DESTROY %p done\n", db)); -- if (db->hash) -- SvREFCNT_dec(db->hash) ; -- if (db->compare) -- SvREFCNT_dec(db->compare) ; -- if (db->prefix) -- SvREFCNT_dec(db->prefix) ; -- if (db->filter_fetch_key) -- SvREFCNT_dec(db->filter_fetch_key) ; -- if (db->filter_store_key) -- SvREFCNT_dec(db->filter_store_key) ; -- if (db->filter_fetch_value) -- SvREFCNT_dec(db->filter_fetch_value) ; -- if (db->filter_store_value) -- SvREFCNT_dec(db->filter_store_value) ; -- safefree(db) ; -+ CODE: -+ RETVAL = 0; -+ if (db && db->owner == aTHX) { -+ RETVAL = db_DESTROY(db); - #ifdef DB_VERSION_MAJOR -- if (RETVAL > 0) -- RETVAL = -1 ; -+ if (RETVAL > 0) -+ RETVAL = -1 ; - #endif -+ } -+ OUTPUT: -+ RETVAL -+ CLEANUP: -+ Trace(("DESTROY %p done\n", db)); -+ if (db && db->owner == aTHX) { -+ if (db->hash) -+ SvREFCNT_dec(db->hash) ; -+ if (db->compare) -+ SvREFCNT_dec(db->compare) ; -+ if (db->prefix) -+ SvREFCNT_dec(db->prefix) ; -+ if (db->filter_fetch_key) -+ SvREFCNT_dec(db->filter_fetch_key) ; -+ if (db->filter_store_key) -+ SvREFCNT_dec(db->filter_store_key) ; -+ if (db->filter_fetch_value) -+ SvREFCNT_dec(db->filter_fetch_value) ; -+ if (db->filter_store_value) -+ SvREFCNT_dec(db->filter_store_value) ; -+ safefree(db) ; -+ } - - - int -diff --git a/MANIFEST b/MANIFEST -index e460e81..47f43f7 100644 ---- a/MANIFEST -+++ b/MANIFEST -@@ -27,6 +27,7 @@ t/db-btree.t - t/db-hash.t - t/db-recno.t - t/pod.t -+t/db-threads.t - typemap - version.c - META.yml Module meta-data (added by MakeMaker) -diff --git a/t/db-threads.t b/t/db-threads.t -new file mode 100644 -index 0000000..b9f69b6 ---- /dev/null -+++ b/t/db-threads.t -@@ -0,0 +1,46 @@ -+#!./perl -+ -+use warnings; -+use strict; -+use Config; -+use Fcntl; -+use Test::More; -+use DB_File; -+ -+if (-d "lib" && -f "TEST") { -+ if ($Config{'extensions'} !~ /\bDB_File\b/ ) { -+ plan skip_all => 'DB_File was not built'; -+ } -+} -+plan skip_all => 'Threads are disabled' -+ unless $Config{usethreads}; -+ -+plan tests => 7; -+ -+# Check DBM back-ends do not destroy objects from then-spawned threads. -+# RT#61912. -+use_ok('threads'); -+ -+my %h; -+unlink <threads*>; -+ -+my $db = tie %h, 'DB_File', 'threads', O_RDWR|O_CREAT, 0640; -+isa_ok($db, 'DB_File'); -+ -+for (1 .. 2) { -+ ok(threads->create( -+ sub { -+ $SIG{'__WARN__'} = sub { fail(shift) }; # debugging perl panics -+ # report it by spurious TAP line -+ 1; -+ }), "Thread $_ created"); -+} -+for (threads->list) { -+ is($_->join, 1, "A thread exited successfully"); -+} -+ -+pass("Tied object survived exiting threads"); -+ -+undef $db; -+untie %h; -+unlink <threads*>; --- -1.9.3 - diff --git a/DB_File-1.838-Destroy-DB_File-objects-only-from-original-thread-co.patch b/DB_File-1.838-Destroy-DB_File-objects-only-from-original-thread-co.patch new file mode 100644 index 0000000..cdb51d5 --- /dev/null +++ b/DB_File-1.838-Destroy-DB_File-objects-only-from-original-thread-co.patch @@ -0,0 +1,180 @@ +From bfb2cb3cddffa144b521bb5dff76af1e065288ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com> +Date: Tue, 10 Jun 2014 14:28:09 +0200 +Subject: [PATCH] Destroy DB_File objects only from original thread context +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch fixes a crash when destroing a hash tied to a DB_File +database after spawning a thread: + +use Fcntl; +use DB_File; +use threads; +tie(my %dbtest, 'DB_File', "test.db", O_RDWR|O_CREAT, 0666); +threads->new(sub {})->join; + +This crashed or paniced depending on how perl was configured. + +Closes RT#61912. + +Signed-off-by: Petr Písař <ppi...@redhat.com> +--- + DB_File.xs | 50 +++++++++++++++++++++++++++++++------------------- + MANIFEST | 1 + + t/db-threads.t | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 78 insertions(+), 19 deletions(-) + create mode 100644 t/db-threads.t + +diff --git a/DB_File.xs b/DB_File.xs +index f417b22..ed6a904 100755 +--- a/DB_File.xs ++++ b/DB_File.xs +@@ -407,6 +407,7 @@ typedef union INFO { + + typedef struct { + DBTYPE type ; ++ tTHX owner ; + DB * dbp ; + SV * compare ; + bool in_compare ; +@@ -1006,6 +1007,7 @@ SV * sv ; + name, flags, mode, sv == NULL) ; + #endif + Zero(RETVAL, 1, DB_File_type) ; ++ RETVAL->owner = aTHX; + + /* Default to HASH */ + RETVAL->filtering = 0 ; +@@ -1278,6 +1280,7 @@ SV * sv ; + + /* printf("In ParseOpenInfo name=[%s] flags=[%d] mode = [%d]\n", name, flags, mode) ; */ + Zero(RETVAL, 1, DB_File_type) ; ++ RETVAL->owner = aTHX; + + /* Default to HASH */ + RETVAL->filtering = 0 ; +@@ -1597,27 +1600,36 @@ db_DESTROY(db) + INIT: + CurrentDB = db ; + Trace(("DESTROY %p\n", db)); +- CLEANUP: +- Trace(("DESTROY %p done\n", db)); +- if (db->hash) +- SvREFCNT_dec(db->hash) ; +- if (db->compare) +- SvREFCNT_dec(db->compare) ; +- if (db->prefix) +- SvREFCNT_dec(db->prefix) ; +- if (db->filter_fetch_key) +- SvREFCNT_dec(db->filter_fetch_key) ; +- if (db->filter_store_key) +- SvREFCNT_dec(db->filter_store_key) ; +- if (db->filter_fetch_value) +- SvREFCNT_dec(db->filter_fetch_value) ; +- if (db->filter_store_value) +- SvREFCNT_dec(db->filter_store_value) ; +- safefree(db) ; ++ CODE: ++ RETVAL = 0; ++ if (db && db->owner == aTHX) { ++ RETVAL = db_DESTROY(db); + #ifdef DB_VERSION_MAJOR +- if (RETVAL > 0) +- RETVAL = -1 ; ++ if (RETVAL > 0) ++ RETVAL = -1 ; + #endif ++ } ++ OUTPUT: ++ RETVAL ++ CLEANUP: ++ Trace(("DESTROY %p done\n", db)); ++ if (db && db->owner == aTHX) { ++ if (db->hash) ++ SvREFCNT_dec(db->hash) ; ++ if (db->compare) ++ SvREFCNT_dec(db->compare) ; ++ if (db->prefix) ++ SvREFCNT_dec(db->prefix) ; ++ if (db->filter_fetch_key) ++ SvREFCNT_dec(db->filter_fetch_key) ; ++ if (db->filter_store_key) ++ SvREFCNT_dec(db->filter_store_key) ; ++ if (db->filter_fetch_value) ++ SvREFCNT_dec(db->filter_fetch_value) ; ++ if (db->filter_store_value) ++ SvREFCNT_dec(db->filter_store_value) ; ++ safefree(db) ; ++ } + + + int +diff --git a/MANIFEST b/MANIFEST +index e460e81..47f43f7 100644 +--- a/MANIFEST ++++ b/MANIFEST +@@ -27,6 +27,7 @@ t/db-btree.t + t/db-hash.t + t/db-recno.t + t/pod.t ++t/db-threads.t + typemap + version.c + META.yml Module meta-data (added by MakeMaker) +diff --git a/t/db-threads.t b/t/db-threads.t +new file mode 100644 +index 0000000..b9f69b6 +--- /dev/null ++++ b/t/db-threads.t +@@ -0,0 +1,46 @@ ++#!./perl ++ ++use warnings; ++use strict; ++use Config; ++use Fcntl; ++use Test::More; ++use DB_File; ++ ++if (-d "lib" && -f "TEST") { ++ if ($Config{'extensions'} !~ /\bDB_File\b/ ) { ++ plan skip_all => 'DB_File was not built'; ++ } ++} ++plan skip_all => 'Threads are disabled' ++ unless $Config{usethreads}; ++ ++plan tests => 7; ++ ++# Check DBM back-ends do not destroy objects from then-spawned threads. ++# RT#61912. ++use_ok('threads'); ++ ++my %h; ++unlink <threads*>; ++ ++my $db = tie %h, 'DB_File', 'threads', O_RDWR|O_CREAT, 0640; ++isa_ok($db, 'DB_File'); ++ ++for (1 .. 2) { ++ ok(threads->create( ++ sub { ++ $SIG{'__WARN__'} = sub { fail(shift) }; # debugging perl panics ++ # report it by spurious TAP line ++ 1; ++ }), "Thread $_ created"); ++} ++for (threads->list) { ++ is($_->join, 1, "A thread exited successfully"); ++} ++ ++pass("Tied object survived exiting threads"); ++ ++undef $db; ++untie %h; ++unlink <threads*>; +-- +2.5.5 + diff --git a/perl-DB_File.spec b/perl-DB_File.spec index 1075102..6909799 100644 --- a/perl-DB_File.spec +++ b/perl-DB_File.spec @@ -1,5 +1,5 @@ Name: perl-DB_File -Version: 1.835 +Version: 1.838 Release: 1%{?dist} Summary: Perl5 access to Berkeley DB version 1.x License: GPL+ or Artistic @@ -8,9 +8,13 @@ URL: http://search.cpan.org/dist/DB_File/ Source0: http://www.cpan.org/authors/id/P/PM/PMQS/DB_File-%{version}.tar.gz # Destroy DB_File objects only from original thread context, bug #1107732, # CPAN RT#96357 -Patch0: DB_File-1.833-Destroy-DB_File-objects-only-from-original-thread-co.patch +Patch0: DB_File-1.838-Destroy-DB_File-objects-only-from-original-thread-co.patch +BuildRequires: coreutils +BuildRequires: findutils BuildRequires: libdb-devel BuildRequires: perl +BuildRequires: perl-devel +BuildRequires: perl-generators BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::Constant) BuildRequires: perl(ExtUtils::MakeMaker) >= 5.16 @@ -58,8 +62,8 @@ make %{?_smp_mflags} %install make pure_install DESTDIR=$RPM_BUILD_ROOT -find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; -find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm -f {} \; +find $RPM_BUILD_ROOT -type f -name .packlist -delete +find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete %{_fixperms} $RPM_BUILD_ROOT/* %check @@ -72,6 +76,9 @@ make test %{_mandir}/man3/* %changelog +* Mon May 16 2016 Petr Pisar <ppi...@redhat.com> - 1.838-1 +- 1.838 bump + * Fri Jan 02 2015 Petr Pisar <ppi...@redhat.com> - 1.835-1 - 1.835 bump diff --git a/sources b/sources index 2d4df52..eaa20c7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0ae7910cabc31a44e50b713a8a475514 DB_File-1.835.tar.gz +1b489d4c85784135df72836d491a2217 DB_File-1.838.tar.gz -- cgit v0.12 http://pkgs.fedoraproject.org/cgit/perl-DB_File.git/commit/?h=f22&id=cdb096ba56cb43f37c8d668fdc4534afc46df206 -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl perl-devel mailing list perl-devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/perl-devel@lists.fedoraproject.org