import perl-DB_File-1.841-1.module_el8.1.0+225+978beb03

i8c-stream-5.26 changed/i8c-stream-5.26/perl-DB_File-1.841-1.module_el8.1.0+225+978beb03
MSVSphere Packaging Team 9 months ago
commit 4035bd651d

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/DB_File-1.841.tar.gz

@ -0,0 +1 @@
8cea40755c7b2dd77d4081fb3ec43311875be99d SOURCES/DB_File-1.841.tar.gz

@ -0,0 +1,180 @@
From bfb2cb3cddffa144b521bb5dff76af1e065288ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@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ř <ppisar@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

@ -0,0 +1,194 @@
# Run optional test
%if ! (0%{?rhel})
%bcond_without perl_DB_File_enables_optional_test
%else
%bcond_with perl_DB_File_enables_optional_test
%endif
Name: perl-DB_File
Version: 1.841
Release: 1%{?dist}
Summary: Perl5 access to Berkeley DB version 1.x
License: GPL+ or Artistic
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.838-Destroy-DB_File-objects-only-from-original-thread-co.patch
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: gcc
BuildRequires: libdb-devel
BuildRequires: perl-devel
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(ExtUtils::Constant)
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
# File::Copy not needed if ExtUtils::Constant is available
BuildRequires: perl(strict)
# Run-time:
BuildRequires: perl(Carp)
# DynaLoader not needed if XSLoader is available
BuildRequires: perl(Exporter)
BuildRequires: perl(Fcntl)
BuildRequires: perl(File::Spec)
BuildRequires: perl(Tie::Hash)
BuildRequires: perl(warnings)
BuildRequires: perl(XSLoader)
# Tests:
BuildRequires: perl(Symbol)
BuildRequires: perl(Test::More)
BuildRequires: perl(threads)
%if %{with perl_DB_File_enables_optional_test} && !%{defined perl_bootstrap}
# Optional tests:
# Data::Dumper not useful
BuildRequires: perl(Test::Pod) >= 1.00
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(Fcntl)
Requires: perl(XSLoader)
%{?perl_default_filter}
%description
DB_File is a module which allows Perl programs to make use of the facilities
provided by Berkeley DB version 1.x (if you have a newer version of DB, you
will be limited to functionality provided by interface of version 1.x). The
interface defined here mirrors the Berkeley DB interface closely.
%prep
%setup -q -n DB_File-%{version}
%patch0 -p1
find -type f -exec chmod -x {} +
perl -MConfig -pi -e 's|^#!.*perl|$Config{startperl}|' dbinfo
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 OPTIMIZE="$RPM_OPT_FLAGS"
make %{?_smp_mflags}
%install
make pure_install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
%{_fixperms} $RPM_BUILD_ROOT/*
%check
make test
%files
%doc Changes dbinfo README
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/DB_File*
%{_mandir}/man3/*
%changelog
* Thu Apr 25 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 1.841-1
- Rebuilt for MSVSphere 8.9
* Tue Apr 03 2018 Petr Pisar <ppisar@redhat.com> - 1.841-1
- 1.841 bump
* Mon Feb 19 2018 Jitka Plesnikova <jplesnik@redhat.com> - 1.840-398
- Add build-require gcc
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.840-397
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.840-396
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.840-395
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jun 07 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.840-394
- Perl 5.26 re-rebuild of bootstrapped packages
* Sat Jun 03 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.840-393
- Perl 5.26 rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.840-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Jan 02 2017 Petr Pisar <ppisar@redhat.com> - 1.840-1
- 1.840 bump
* Wed May 18 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.838-2
- Perl 5.24 re-rebuild of bootstrapped packages
* Mon May 16 2016 Petr Pisar <ppisar@redhat.com> - 1.838-1
- 1.838 bump
* Sat May 14 2016 Jitka Plesnikova <jplesnik@redhat.com> - 1.835-365
- Increase release to favour standalone package
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.835-348
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.835-347
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Jun 10 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.835-346
- Perl 5.22 re-rebuild of bootstrapped packages
* Thu Jun 04 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.835-345
- Increase release to favour standalone package
* Wed Jun 03 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.835-2
- Perl 5.22 rebuild
* Fri Jan 02 2015 Petr Pisar <ppisar@redhat.com> - 1.835-1
- 1.835 bump
* Thu Dec 11 2014 Petr Pisar <ppisar@redhat.com> - 1.834-1
- 1.834 bump
* Wed Dec 10 2014 Petr Pisar <ppisar@redhat.com> - 1.833-1
- 1.833 bump
* Sun Sep 07 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.831-311
- Perl 5.20 re-rebuild of bootstrapped packages
* Wed Sep 03 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.831-310
- Increase release to favour standalone package
* Tue Aug 26 2014 Jitka Plesnikova <jplesnik@redhat.com> - 1.831-7
- Perl 5.20 rebuild
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.831-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Aug 08 2014 Petr Pisar <ppisar@redhat.com> - 1.831-5
- Build-require Test::More always because of the new thread tests
* Thu Aug 07 2014 Petr Pisar <ppisar@redhat.com> - 1.831-4
- Initialize db_DESTROY return variable (bug #1107732)
* Thu Aug 07 2014 Petr Pisar <ppisar@redhat.com> - 1.831-3
- Destroy DB_File objects only from original thread context (bug #1107732)
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.831-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Tue Nov 19 2013 Petr Pisar <ppisar@redhat.com> - 1.831-1
- 1.831 bump
* Mon Nov 04 2013 Petr Pisar <ppisar@redhat.com> - 1.830-1
- 1.830 bump
* Wed Aug 14 2013 Jitka Plesnikova <jplesnik@redhat.com> - 1.829-4
- Perl 5.18 re-rebuild of bootstrapped packages
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.829-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Fri Jul 12 2013 Petr Pisar <ppisar@redhat.com> - 1.829-2
- Perl 5.18 rebuild
* Wed Jul 10 2013 Petr Pisar <ppisar@redhat.com> - 1.829-1
- 1.829 bump
* Thu May 09 2013 Petr Pisar <ppisar@redhat.com> - 1.828-1
- 1.828 bump
* Thu Mar 21 2013 Petr Pisar <ppisar@redhat.com> 1.827-1
- Specfile autogenerated by cpanspec 1.78.
Loading…
Cancel
Save