summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-10-08 18:03:07 +0000
committerZac Medico <zmedico@gentoo.org>2008-10-08 18:03:07 +0000
commit25cb16c01248eba08c9cf615d5460fb269a74b18 (patch)
tree89264db0195afce9e3451c8cf24047e724521d42 /bin
parent716fbeb5557379fdaf2761e76c436b6c5a7eb180 (diff)
downloadportage-25cb16c01248eba08c9cf615d5460fb269a74b18.tar.gz
portage-25cb16c01248eba08c9cf615d5460fb269a74b18.tar.bz2
portage-25cb16c01248eba08c9cf615d5460fb269a74b18.zip
Use separate temp directories in order to avoid potential name collisions.
svn path=/main/trunk/; revision=11657
Diffstat (limited to 'bin')
-rwxr-xr-xbin/doins15
1 files changed, 8 insertions, 7 deletions
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))