diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2018-07-16 08:47:01 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2018-07-16 08:47:01 +0100 |
commit | 3263e82a5aec667fd64c437fe5955ca3910768bf (patch) | |
tree | 11c8fbb7db91ed8e1ca11227265c997f39cf5e52 /cpan | |
parent | 6d37e916c310482d19ce4cd94848823cad43507a (diff) | |
download | perl-3263e82a5aec667fd64c437fe5955ca3910768bf.tar.gz |
Upgrade DB_File from version 1.841 to 1.842
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/DB_File/DB_File.pm | 6 | ||||
-rw-r--r-- | cpan/DB_File/DB_File.xs | 2 | ||||
-rw-r--r-- | cpan/DB_File/t/db-btree.t | 4 | ||||
-rw-r--r-- | cpan/DB_File/t/db-hash.t | 5 | ||||
-rw-r--r-- | cpan/DB_File/t/db-recno.t | 5 | ||||
-rw-r--r-- | cpan/DB_File/t/db-threads.t | 53 |
6 files changed, 71 insertions, 4 deletions
diff --git a/cpan/DB_File/DB_File.pm b/cpan/DB_File/DB_File.pm index 7a0051cde9..983741a771 100644 --- a/cpan/DB_File/DB_File.pm +++ b/cpan/DB_File/DB_File.pm @@ -2,7 +2,7 @@ # # Written by Paul Marquess (pmqs@cpan.org) # -# Copyright (c) 1995-2016 Paul Marquess. All rights reserved. +# Copyright (c) 1995-2018 Paul Marquess. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. @@ -162,8 +162,10 @@ our ($VERSION, @ISA, @EXPORT, $AUTOLOAD, $DB_BTREE, $DB_HASH, $DB_RECNO); our ($db_version, $use_XSLoader, $splice_end_array_no_length, $splice_end_array, $Error); use Carp; +# Module not thread safe, so don't clone +sub CLONE_SKIP { 1 } -$VERSION = "1.841" ; +$VERSION = "1.842" ; $VERSION = eval $VERSION; # needed for dev releases { diff --git a/cpan/DB_File/DB_File.xs b/cpan/DB_File/DB_File.xs index 04c8f74adb..6e6e154ffd 100644 --- a/cpan/DB_File/DB_File.xs +++ b/cpan/DB_File/DB_File.xs @@ -6,7 +6,7 @@ All comments/suggestions/problems are welcome - Copyright (c) 1995-2016 Paul Marquess. All rights reserved. + Copyright (c) 1995-2018 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/DB_File/t/db-btree.t b/cpan/DB_File/t/db-btree.t index 4e2968eeb5..4ff405e51d 100644 --- a/cpan/DB_File/t/db-btree.t +++ b/cpan/DB_File/t/db-btree.t @@ -31,6 +31,7 @@ EOM use DB_File; use Fcntl; +use File::Temp qw(tempdir) ; print "1..197\n"; @@ -125,6 +126,9 @@ my $db185mode = ($DB_File::db_version == 1 && ! $DB_File::db_185_compat) ; my $null_keys_allowed = ($DB_File::db_ver < 2.004010 || $DB_File::db_ver >= 3.1 ); +my $TEMPDIR = tempdir( CLEANUP => 1 ); +chdir $TEMPDIR; + my $Dfile = "dbbtree.tmp"; unlink $Dfile; diff --git a/cpan/DB_File/t/db-hash.t b/cpan/DB_File/t/db-hash.t index f4c8f957b0..97b77fcfd7 100644 --- a/cpan/DB_File/t/db-hash.t +++ b/cpan/DB_File/t/db-hash.t @@ -3,6 +3,7 @@ use warnings; use strict; use Config; +use File::Temp qw(tempdir) ; BEGIN { if(-d "lib" && -f "TEST") { @@ -82,6 +83,8 @@ sub safeUntie return $no_inner; } +my $TEMPDIR = tempdir( CLEANUP => 1 ); +chdir $TEMPDIR; my $Dfile = "dbhash.tmp"; my $Dfile2 = "dbhash2.tmp"; @@ -132,7 +135,7 @@ ok(14, $@ =~ /^DB_File::HASHINFO::FETCH - Unknown element 'fred' at/ ); # Now check the interface to HASH my ($X, %h); ok(15, $X = tie(%h, 'DB_File',$Dfile, O_RDWR|O_CREAT, 0640, $DB_HASH ) ); -die "Could not tie: $!" unless $X; +die "Could not tie: $!" unless defined $X; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, $blksize,$blocks) = stat($Dfile); diff --git a/cpan/DB_File/t/db-recno.t b/cpan/DB_File/t/db-recno.t index bd198dcf2f..18b7e9e287 100644 --- a/cpan/DB_File/t/db-recno.t +++ b/cpan/DB_File/t/db-recno.t @@ -14,6 +14,8 @@ BEGIN { use DB_File; use Fcntl; +use File::Temp qw(tempdir) ; + our ($dbh, $Dfile, $bad_ones, $FA); # full tied array support started in Perl 5.004_57 @@ -147,6 +149,9 @@ my $total_tests = 181 ; $total_tests += $splice_tests if $FA ; print "1..$total_tests\n"; +my $TEMPDIR = tempdir( CLEANUP => 1 ); +chdir $TEMPDIR; + $Dfile = "recno.tmp"; unlink $Dfile ; diff --git a/cpan/DB_File/t/db-threads.t b/cpan/DB_File/t/db-threads.t new file mode 100644 index 0000000000..f9bce95356 --- /dev/null +++ b/cpan/DB_File/t/db-threads.t @@ -0,0 +1,53 @@ +#!./perl + +use warnings; +use strict; +use Config; +use Fcntl; +use Test::More; +use DB_File; +use File::Temp qw(tempdir) ; + +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 skip_all => 'Thread test needs Perl 5.8.7 or greater' + unless $] >= 5.008007; + +plan tests => 7; + +# Check DBM back-ends do not destroy objects from then-spawned threads. +# RT#61912. +use_ok('threads'); + +my $TEMPDIR = tempdir( CLEANUP => 1 ); +chdir $TEMPDIR; + +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*>; |