ba227c00ba4786dcbe2482cc6282e36e867c778b hiram Tue Oct 22 15:06:25 2024 -0700 something fishy here not sure what refs #34685 diff --git src/hg/utils/automation/HgAutomate.pm src/hg/utils/automation/HgAutomate.pm index 12f5f30..404429a 100755 --- src/hg/utils/automation/HgAutomate.pm +++ src/hg/utils/automation/HgAutomate.pm @@ -559,35 +559,35 @@ # per-seq files, or use set of multi-seq files). $splitThreshold = 100; # ssh command and its options, the extra -o options prevent asking # questions about adding machines to known hosts $runSSH = "ssh -x -o 'StrictHostKeyChecking = no' -o 'BatchMode = yes'"; $setMachtype = "setenv MACHTYPE `uname -m | sed -e 's/i686/i386/;'`"; ######################################################################### # General utility subroutines: ### decide on an appropriate temporary directory sub tmpDir { my $tDir="/tmp"; # default, most likely overridden - if (defined($ENV{'TMPDIR'}) && -d $ENV{'TMPDIR'}) { # TMPDIR above all else + if (defined($ENV{'TMPDIR'}) && -d $ENV{'TMPDIR'} && -w "$ENV{'TMPDIR'}") { # TMPDIR above all else $tDir = $ENV{'TMPDIR'}; - } elsif ( -d "/data/tmp" ) { # UCSC local file system + } elsif ( -d "/data/tmp" && -w "/data/tmp" ) { # UCSC local file system $tDir = "/data/tmp"; - } elsif ( -d "/scratch/tmp" ) { # UCSC cluster node local file system + } elsif ( -d "/scratch/tmp" && -w "/scratch/tmp" ) { # UCSC cluster node local file system $tDir = "/scratch/tmp"; } else { my $tmpSz = `df --output=avail -k /tmp | tail -1`; my $shmSz = `df --output=avail -k /dev/shm | tail -1`; chomp ($tmpSz, $shmSz); if ( $shmSz > $tmpSz ) { # use /dev/shm when it is the larger one my $shmTmp = "/dev/shm/tmp"; my $saveUmask = umask(0000); # do not allow user's umask to interfere if (! mkdir($shmTmp, 0777)) { my $errString = $!; if ($errString =~ /File exists/i) { # this error OK if ( -w "${shmTmp}" ) { # use only when writable $tDir = $shmTmp; } } # mkdir other errors cause use of default