Moved temporary files from /tmp to /var/tmp. Use a to avoid unprintable characters...
authorfuzzyray <fuzzyray@gentoo.org>
Mon, 21 Jul 2008 18:38:34 +0000 (18:38 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Mon, 21 Jul 2008 18:38:34 +0000 (18:38 -0000)
svn path=/; revision=499

trunk/src/revdep-rebuild/revdep-rebuild

index 1694e8c590a8e6f1358ff3ef28ead0372e047d73..bae694a1bc1dc88fe5e30f37eafc01453c742226 100755 (executable)
@@ -512,7 +512,7 @@ setup_tmpdir() {
        else
                die 1 "Unable to find or create a satisfactory location for temporary files"
        fi
-       [[ $VERBOSE ]] && einfo "Temporary files are located in $PWD"
+       [[ $VERBOSE ]] && einfo "Temporary cache files are located in $PWD"
        setup_rm
 }
 get_search_env() {
@@ -521,7 +521,7 @@ get_search_env() {
        local uid=$(python -c 'import os; import pwd; print pwd.getpwuid(os.getuid())[0]')
        # Find a place to put temporary files
        # Use "${TMPDIR}/revdep-rebuild" or /tmp/revdep-rebuild
-       local tmp_target="${TMPDIR:=/tmp}/${APP_NAME}-${uid}"
+       local tmp_target="/var/tmp/${APP_NAME}-${uid}-cache"
 
        # From here on all work is done inside the temporary directory
        setup_tmpdir "$tmp_target" "$uid"
@@ -542,14 +542,18 @@ get_search_env() {
                        # Set to "<tab>$SONAME<space>"
                        SONAME_SEARCH=$'\t'"$SONAME "
                fi
-               local uuid="${SONAME##*/}"
-               uuid="${uuid//[[:space:]]}"
-               uuid="${uuid//\*}"
-               uuid="${uuid//\\}"
+               # Hash the SONAME, to avoid unprintable characters.  We are using HMAC since
+               # the interface has remained consistent since python 2.2
+               local uuid_hash=$(python -c "import hmac; print hmac.new('revdep-rebuild',\"${SONAME##*/}\").hexdigest()")
+               # Delete me - keeping for reference if needed
+               #local uuid="${SONAME##*/}"
+               #uuid="${uuid//[[:space:]]}"
+               #uuid="${uuid//\*}"
+               #uuid="${uuid//\\}"
                HEAD_TEXT="using $SONAME"
                OK_TEXT="There are no dynamic links to $SONAME"
                unset WORKING_TEXT
-               setup_tmpdir $tmp_target"/"$uuid" "$uid"
+               setup_tmpdir "$tmp_target"/"$uuid_hash" "$uid"
        fi
 
        # If any of our temporary files are older than 1 day, remove them all