From 031e755303adea63d21d5d7d884ffca90d31dbec Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 11 Nov 2017 18:00:57 -0600 Subject: [PATCH] installEpics.pl: Make temporary install filename more different A parallel build was seen matching the temporary name in a wildcard. Now the temporary name both starts and ends differently. --- src/tools/installEpics.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tools/installEpics.pl b/src/tools/installEpics.pl index f5a77de49..c64324f37 100644 --- a/src/tools/installEpics.pl +++ b/src/tools/installEpics.pl @@ -52,9 +52,9 @@ unless (-d $install_dir || -l $install_dir) { foreach my $source (@ARGV) { die "$tool: No such file '$source'" unless -f $source; - my $basename = basename($source); - my $target = "$install_dir/$basename"; - my $temp = "$target.$$"; + my $name = basename($source); + my $temp = "$install_dir/TEMP.$name.$$"; + my $target = "$install_dir/$name"; if (-f $target) { next if -M $target < -M $source and -C $target < -C $source; @@ -64,8 +64,10 @@ foreach my $source (@ARGV) { } # Using copy + rename fixes problems with parallel builds - copy($source, $temp) or die "$tool: Copy failed: $!\n"; - rename $temp, $target or die "$tool: Rename failed: $!\n"; + copy($source, $temp) or die "$tool: Copy failed: $!\n" . + "$tool:\t$source -> $temp\n"; + rename $temp, $target or die "$tool: Rename failed: $!\n" . + "$tool:\t$temp -> $target\n"; # chmod 0555 DOES work on Win32, but the above # chmod 0777 fails to install a newer version on top. @@ -79,7 +81,7 @@ sub Usage { print << "END"; Usage: $tool [OPTIONS]... SRCS... DEST -d Create non-existing directories - -h Print usage + -h Print usage and exit -m mode Octal permissions for installed files ($omode by default) -q Install quietly SRCS Source files to be installed