[Rt-commit] rt branch, 4.0/policy-race-condition, created. rt-4.0.17-69-g270d1bb
Alex Vandiver
alexmv at bestpractical.com
Wed Aug 7 12:16:06 EDT 2013
The branch, 4.0/policy-race-condition has been created
at 270d1bb80e65a9a01188ea19b4b3c57330d4c986 (commit)
- Log -----------------------------------------------------------------
commit 270d1bb80e65a9a01188ea19b4b3c57330d4c986
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Aug 7 12:10:02 2013 -0400
Attempt to avoid filesystem race conditions by skipping chdir
During heavily parallel testing, the following may occur:
Can't cd to (t/tmp/) api-attribute.t-qrUlYS47: No such file or directory
at t/99-policy.t line 9.
at /opt/smoke/perl/lib/5.12.3/File/Find.pm line 881.
This is caused by (in this case) the t/tmp/api-attribute.t-qrUlYS47
directory being found in the readdir() call, but having already been
unlink()'d before chdir() can be called.
File::Find allows skipping the chdir() call by setting no_chdir => 1.
This causes $_ to be equivalent to $File::Find::name, which is
irrelevant to our use case. Remove the race condition by skipping the
chdir(), which does not affect the contents of @files, or the tests run.
diff --git a/t/99-policy.t b/t/99-policy.t
index 01c4091..f4b80e8 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -5,7 +5,8 @@ use RT::Test;
use File::Find;
my @files;
-find( sub { push @files, $File::Find::name if -f },
+find( { wanted => sub { push @files, $File::Find::name if -f },
+ no_chdir => 1 },
qw{etc lib share t bin sbin devel/tools} );
if ( my $dir = `git rev-parse --git-dir 2>/dev/null` ) {
# We're in a git repo, use the ignore list
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list