From 6cc659feea01d1b9bb051dff6cd62a683e0fb749 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 15 Nov 2016 19:42:06 -0800 Subject: [PATCH] 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 --- bin/git-archive-all.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/git-archive-all.sh b/bin/git-archive-all.sh index 68c31eac4975..8c292b54d522 100755 --- a/bin/git-archive-all.sh +++ b/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 -- 2.47.3