summaryrefslogtreecommitdiff
path: root/make_ext.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-12 07:17:45 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-12 07:17:45 +0100
commitbc72ff4919d7f1638a7ea29ecb264459926b1933 (patch)
tree364428894a5b2944dccdf6a81daffde8722113ee /make_ext.pl
parent1a7ec96dac6ffc7589a460209cc75c4b879568ce (diff)
downloadperl-bc72ff4919d7f1638a7ea29ecb264459926b1933.tar.gz
Avoid a parallel make race condition where we load a half-copied module.
Diffstat (limited to 'make_ext.pl')
-rw-r--r--make_ext.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/make_ext.pl b/make_ext.pl
index b5966a9e9f..f88c208046 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -231,8 +231,11 @@ sub build_extension {
$perl ||= "$up/miniperl";
my $return_dir = $up;
my $lib_dir = "$up/lib";
+ # $lib_dir must be last, as we're copying files into it, and in a parallel
+ # make there's a race condition if one process tries to open a module that
+ # another process has half-written.
$ENV{PERL5LIB}
- = join $Config{path_sep}, $lib_dir, map {"$up/$_"} @toolchain;
+ = join $Config{path_sep}, (map {"$up/$_"} @toolchain), $lib_dir;
unless (chdir "$ext_dir") {
warn "Cannot cd to $ext_dir: $!";