Permalink
Browse files

git-archive-all.sh: use an actually unique tmp dir

git archive into $TMPDIR/$(basename "$(pwd)").$FORMAT is not unique;
if two runs are running simultaneously, this will collide.  Make
TMPDIR actually unique, and then the cleanup can just remove the whole
directory as well.

Signed-off-by: Dan Mick <dan.mick@redhat.com>
  • Loading branch information...
1 parent 83ce0fe commit 6cc659feea01d1b9bb051dff6cd62a683e0fb749 @dmick dmick committed Nov 16, 2016
Showing with 2 additions and 3 deletions.
  1. +2 −3 bin/git-archive-all.sh
@@ -48,8 +48,7 @@ IFS='
'
function cleanup () {
- rm -f $TMPFILE
- rm -f $TOARCHIVE
+ rm -rf $TMPDIR
IFS="$OLD_IFS"
}
@@ -105,7 +104,7 @@ readonly PROGRAM=`basename "$0"`
readonly VERSION=0.2
OLD_PWD="`pwd`"
-TMPDIR=${TMPDIR:-/tmp}
+TMPDIR=`mktemp -d "${TMPDIR:-/tmp}/$PROGRAM.XXXXXX"`
TMPFILE=`mktemp "$TMPDIR/$PROGRAM.XXXXXX"` # Create a place to store our work's progress
TOARCHIVE=`mktemp "$TMPDIR/$PROGRAM.toarchive.XXXXXX"`
OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default

0 comments on commit 6cc659f

Please sign in to comment.