Skip Menu |

This queue is for tickets about the File-Properties CPAN distribution.

Report information
The Basics
Id: 72569
Status: resolved
Priority: 0/
Queue: File-Properties

People
Owner: wohl [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.01
Fixed in: 0.02



Subject: "Database is locked" on *BSD systems
Regarding the test failures on FreeBSD (see http://matrix.cpantesters.org/?dist=File-Properties;reports=1;os=freebsd ): the error message "DBD::SQLite::db do failed: database is locked" indicates that a tempfile created by File::Temp is used for a sqlite database file. On *BSD systems File::Temp automatically locks a temporary file, which conflicts with the file locking done by SQLite. To fix this, you can use the option EXLOCK=>0. See the File::Temp documentation. Regards, Slaven
Thanks for the bug report and advice on how to fix it. The attached patch adds the necessary EXLOCK=>0 argument in the affected test scripts, and has been confirmed to work on the most recent FreeBSD release. It doesn't seem worth releasing a new version of File::Properties immediately since (1) the actual library code was not affected by this bug, and (2) it looks as if automated tests will not succeed on any platform at the moment due to the dependency on Image::Magick, for which installation via CPAN is currently broken.
Subject: exlock.patch
diff -rupN t/01database.t t.new/01database.t --- t/01database.t 2011-10-27 19:32:40.000000000 -0600 +++ t.new/01database.t 2011-11-30 20:30:47.000000000 -0700 @@ -14,7 +14,7 @@ use File::Temp; ## Create temporary database file and create a ## File::Properties::Database object attached to it -my $tmpdb = File::Temp->new(SUFFIX => '.db', UNLINK => 1); +my $tmpdb = File::Temp->new(EXLOCK => 0, SUFFIX => '.db', UNLINK => 1); my $opts = {}; ok(my $fpd = File::Properties::Database->new($tmpdb->filename, $opts)); diff -rupN t/03regular.t t.new/03regular.t --- t/03regular.t 2011-10-27 19:32:40.000000000 -0600 +++ t.new/03regular.t 2011-11-30 20:30:58.000000000 -0700 @@ -15,7 +15,7 @@ use File::Temp; ## Create a File::Properties::Cache object attached to a temporary ## database file -my $tmpdb = File::Temp->new(SUFFIX => '.db', UNLINK => 1); +my $tmpdb = File::Temp->new(EXLOCK => 0, SUFFIX => '.db', UNLINK => 1); my $opts = {}; ok(my $fpc = File::Properties::Regular->cache($tmpdb->filename, $opts)); diff -rupN t/04compress.t t.new/04compress.t --- t/04compress.t 2011-10-27 19:32:40.000000000 -0600 +++ t.new/04compress.t 2011-11-30 20:31:06.000000000 -0700 @@ -16,7 +16,7 @@ use Compress::Bzip2; ## Create a File::Properties::Cache object attached to a temporary ## database file -my $tmpdb = File::Temp->new(SUFFIX => '.db'); +my $tmpdb = File::Temp->new(EXLOCK => 0, SUFFIX => '.db'); my $opts = {}; ok(my $fpc = File::Properties::Compressed->cache($tmpdb->filename, $opts)); diff -rupN t/05media.t t.new/05media.t --- t/05media.t 2011-10-27 19:32:40.000000000 -0600 +++ t.new/05media.t 2011-11-30 20:31:13.000000000 -0700 @@ -16,7 +16,7 @@ use Image::Magick; ## Create a File::Properties::Cache object attached to a temporary ## database file -my $tmpdb = File::Temp->new(SUFFIX => '.db'); +my $tmpdb = File::Temp->new(EXLOCK => 0, SUFFIX => '.db'); my $opts = {}; ok(my $fpc = File::Properties::Media->cache($tmpdb->filename, $opts)); diff -rupN t/06properties.t t.new/06properties.t --- t/06properties.t 2011-10-27 19:32:40.000000000 -0600 +++ t.new/06properties.t 2011-11-30 20:31:30.000000000 -0700 @@ -16,7 +16,7 @@ use Compress::Bzip2; ## Create a File::Properties::Cache object attached to a temporary ## database file -my $tmpdb = File::Temp->new(SUFFIX => '.db'); +my $tmpdb = File::Temp->new(EXLOCK => 0, SUFFIX => '.db'); my $opts = {}; ok(my $fpc = File::Properties->cache($tmpdb->filename, $opts));