From: Peter Rabbitson Date: Sat, 23 Feb 2013 14:52:50 +0000 (+0100) Subject: Instrument the lockfile creation failure X-Git-Tag: v0.08209~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7bdb56be5b98d47df5f1dc2f0280f71b1ef8e5a5;p=dbsrgits%2FDBIx-Class.git Instrument the lockfile creation failure Attempting to get to the bottom of http://www.cpantesters.org/cpan/report/27f16417-89ea-1014-a33e-b361b1e9163f --- diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 0c1d3b2..589f82b 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -61,12 +61,25 @@ our ($global_lock_fh, $global_exclusive_lock); sub import { my $self = shift; - my $lockpath = DBICTest::RunMode->tmpdir->file('.dbictest_global.lock'); + my $tmpdir = DBICTest::RunMode->tmpdir; + my $lockpath = $tmpdir->file('.dbictest_global.lock'); { my $u = local_umask(0); # so that the file opens as 666, and any user can lock - sysopen ($global_lock_fh, $lockpath, O_RDWR|O_CREAT) - or die "Unable to open $lockpath: $!"; + sysopen ($global_lock_fh, $lockpath, O_RDWR|O_CREAT) or do { + my $err = $!; + + my @x_tests = map { (defined $_) ? ( $_ ? 1 : 0 ) : 'U' } map {(-e, -d, -f, -r, -w, -x, -o)} ($tmpdir, $lockpath); + + die sprintf <<"EOE", $lockpath, $err, scalar $>, scalar $), (stat($tmpdir))[4,5,2], @x_tests; +Unable to open %s: %s +Process EUID/EGID: %s / %s +TmpDir UID/GID: %s / %s +TmpDir StatMode: %o +TmpDir X-tests: -e:%s -d:%s -f:%s -r:%s -w:%s -x:%s -o:%s +TmpFile X-tests: -e:%s -d:%s -f:%s -r:%s -w:%s -x:%s -o:%s +EOE + }; } for (@_) {