From: Dan Mick Date: Wed, 16 Nov 2016 03:42:06 +0000 (-0800) Subject: git-archive-all.sh: use an actually unique tmp dir X-Git-Tag: v11.1.0~268^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F12011%2Fhead;p=ceph.git 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 --- diff --git a/bin/git-archive-all.sh b/bin/git-archive-all.sh index 68c31eac497..8c292b54d52 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