From 25cb16c01248eba08c9cf615d5460fb269a74b18 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 8 Oct 2008 18:03:07 +0000 Subject: Use separate temp directories in order to avoid potential name collisions. svn path=/main/trunk/; revision=11657 --- bin/doins | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/doins b/bin/doins index 9831fba95..658cb2e5d 100755 --- a/bin/doins +++ b/bin/doins @@ -25,8 +25,9 @@ if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then exit 1 fi -TMP=$T/.doins_tmp -mkdir "$TMP" +export TMP=$T/.doins_tmp +# Use separate directories to avoid potential name collisions. +mkdir -p "$TMP"/{1,2} [[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}" @@ -34,8 +35,8 @@ _doins() { local mysrc="$1" mydir="$2" cleanup="" rval if [ -L "$mysrc" ] ; then - cp "$mysrc" "$TMP" - mysrc="$TMP/${mysrc##*/}" + cp "$mysrc" "$TMP/2" + mysrc="$TMP/2/${mysrc##*/}" cleanup=${mysrc} fi @@ -77,14 +78,14 @@ for x in "$@" ; do pushd "${PWD%/*}" >/dev/null done if [[ $x != $x_orig ]] ; then - mv "$x" "$TMP/$x_orig" - pushd "$TMP" >/dev/null + mv "$x" "$TMP/1/$x_orig" + pushd "$TMP/1" >/dev/null fi find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins if [[ $x != $x_orig ]] ; then popd >/dev/null - mv "$TMP/$x_orig" "$x" + mv "$TMP/1/$x_orig" "$x" fi while popd >/dev/null 2>&1 ; do true ; done ((++success)) -- cgit v1.2.3-1-g7c22