Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit d2f0a66

Browse files
committed
DB_File-1.842
keeping our Makefile.PL silence and UpDowngrade fixes. Document the MacOS build failures & how MacPort can work around the issue. #125238, #125585, RT#133280 Write all test db files into a directory created by File::Temp Protects against any possible races if running a parallel build. #96357: DB_File destructor is not thread-safe Added CLONE_SKIP to DB_File.pm and included the test db-threads.t from the patch. #124944 allow ppport.h-less builds in core
1 parent aaa27d0 commit d2f0a66

File tree

13 files changed

+93
-8
lines changed

13 files changed

+93
-8
lines changed

.git-rr-cache

Submodule .git-rr-cache updated 347 files

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ cpan/DB_File/Makefile.PL Berkeley DB extension makefile writer
453453
cpan/DB_File/t/db-btree.t See if DB_File works
454454
cpan/DB_File/t/db-hash.t See if DB_File works
455455
cpan/DB_File/t/db-recno.t See if DB_File works
456+
cpan/DB_File/t/db-threads.t
456457
cpan/DB_File/typemap Berkeley DB extension interface types
457458
cpan/DB_File/version.c Berkeley DB extension interface version check
458459
cpan/Devel-NYTProf/bin/flamegraph.pl

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ package Maintainers;
461461
},
462462

463463
'DB_File' => {
464-
'DISTRIBUTION' => 'PMQS/DB_File-1.840.tar.gz',
464+
'DISTRIBUTION' => 'PMQS/DB_File-1.842.tar.gz',
465465
'FILES' => q[cpan/DB_File],
466466
'EXCLUDED' => [
467467
qr{^patches/},

cpan/DB_File/DB_File.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Written by Paul Marquess (pmqs@cpan.org)
44
#
5-
# Copyright (c) 1995-2016 Paul Marquess. All rights reserved.
5+
# Copyright (c) 1995-2018 Paul Marquess. All rights reserved.
66
# This program is free software; you can redistribute it and/or
77
# modify it under the same terms as Perl itself.
88

@@ -162,8 +162,10 @@ our ($VERSION, @ISA, @EXPORT, $AUTOLOAD, $DB_BTREE, $DB_HASH, $DB_RECNO);
162162
our ($db_version, $use_XSLoader, $splice_end_array_no_length, $splice_end_array, $Error);
163163
use Carp;
164164

165+
# Module not thread safe, so don't clone
166+
sub CLONE_SKIP { 1 }
165167

166-
$VERSION = "1.840" ;
168+
$VERSION = "1.842" ;
167169
$VERSION = eval $VERSION; # needed for dev releases
168170

169171
{

cpan/DB_File/DB_File.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
All comments/suggestions/problems are welcome
88
9-
Copyright (c) 1995-2016 Paul Marquess. All rights reserved.
9+
Copyright (c) 1995-2018 Paul Marquess. All rights reserved.
1010
This program is free software; you can redistribute it and/or
1111
modify it under the same terms as Perl itself.
1212

cpan/DB_File/Makefile.PL

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ $OS2 = "-DOS2" if $Config{'osname'} eq 'os2' ;
4343
my $WALL = '' ;
4444
#$WALL = ' -Wall ';
4545

46+
# Only want ppport.h t to be used by DB_File.xs when not
47+
# building this module with the perl source distribution.
48+
my $CORE = $ENV{PERL_CORE} ? '' : '-D_NOT_CORE';
49+
4650
WriteMakefile(
4751
NAME => 'DB_File',
4852
LIBS => ["-L${LIB_DIR} $LIBS"],

cpan/DB_File/t/db-btree.t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ EOM
3131

3232
use DB_File;
3333
use Fcntl;
34+
use File::Temp qw(tempdir) ;
3435

3536
print "1..197\n";
3637

@@ -125,6 +126,9 @@ my $db185mode = ($DB_File::db_version == 1 && ! $DB_File::db_185_compat) ;
125126
my $null_keys_allowed = ($DB_File::db_ver < 2.004010
126127
|| $DB_File::db_ver >= 3.1 );
127128

129+
my $TEMPDIR = tempdir( CLEANUP => 1 );
130+
chdir $TEMPDIR;
131+
128132
my $Dfile = "dbbtree.tmp";
129133
unlink $Dfile;
130134

cpan/DB_File/t/db-hash.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use warnings;
44
use strict;
55
use Config;
6+
use File::Temp qw(tempdir) ;
67

78
BEGIN {
89
if(-d "lib" && -f "TEST") {
@@ -82,6 +83,8 @@ sub safeUntie
8283
return $no_inner;
8384
}
8485

86+
my $TEMPDIR = tempdir( CLEANUP => 1 );
87+
chdir $TEMPDIR;
8588

8689
my $Dfile = "dbhash.tmp";
8790
my $Dfile2 = "dbhash2.tmp";
@@ -132,7 +135,7 @@ ok(14, $@ =~ /^DB_File::HASHINFO::FETCH - Unknown element 'fred' at/ );
132135
# Now check the interface to HASH
133136
my ($X, %h);
134137
ok(15, $X = tie(%h, 'DB_File',$Dfile, O_RDWR|O_CREAT, 0640, $DB_HASH ) );
135-
die "Could not tie: $!" unless $X;
138+
die "Could not tie: $!" unless defined $X;
136139

137140
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
138141
$blksize,$blocks) = stat($Dfile);

cpan/DB_File/t/db-recno.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ BEGIN {
1414

1515
use DB_File;
1616
use Fcntl;
17+
use File::Temp qw(tempdir) ;
18+
1719
our ($dbh, $Dfile, $bad_ones, $FA);
1820

1921
# full tied array support started in Perl 5.004_57
@@ -147,6 +149,9 @@ my $total_tests = 181 ;
147149
$total_tests += $splice_tests if $FA ;
148150
print "1..$total_tests\n";
149151

152+
my $TEMPDIR = tempdir( CLEANUP => 1 );
153+
chdir $TEMPDIR;
154+
150155
$Dfile = "recno.tmp";
151156
unlink $Dfile ;
152157

cpan/DB_File/t/db-threads.t

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!./perl
2+
3+
use warnings;
4+
use strict;
5+
use Config;
6+
use Fcntl;
7+
use Test::More;
8+
use DB_File;
9+
use File::Temp qw(tempdir) ;
10+
11+
if (-d "lib" && -f "TEST") {
12+
if ($Config{'extensions'} !~ /\bDB_File\b/ ) {
13+
plan skip_all => 'DB_File was not built';
14+
}
15+
}
16+
plan skip_all => 'Threads are disabled'
17+
unless $Config{usethreads};
18+
19+
plan skip_all => 'Thread test needs Perl 5.8.7 or greater'
20+
unless $] >= 5.008007;
21+
22+
plan tests => 7;
23+
24+
# Check DBM back-ends do not destroy objects from then-spawned threads.
25+
# RT#61912.
26+
use_ok('threads');
27+
28+
my $TEMPDIR = tempdir( CLEANUP => 1 );
29+
chdir $TEMPDIR;
30+
31+
my %h;
32+
unlink <threads*>;
33+
34+
my $db = tie %h, 'DB_File', 'threads', O_RDWR|O_CREAT, 0640;
35+
isa_ok($db, 'DB_File');
36+
37+
for (1 .. 2) {
38+
ok(threads->create(
39+
sub {
40+
$SIG{'__WARN__'} = sub { fail(shift) }; # debugging perl panics
41+
# report it by spurious TAP line
42+
1;
43+
}), "Thread $_ created");
44+
}
45+
for (threads->list) {
46+
is($_->join, 1, "A thread exited successfully");
47+
}
48+
49+
pass("Tied object survived exiting threads");
50+
51+
undef $db;
52+
untie %h;
53+
unlink <threads*>;

0 commit comments

Comments
 (0)