]> arthur.barton.de Git - bup.git/commitdiff
Don't compute local script_home in lib.sh realpath (depended on pwd).
authorRob Browning <rlb@defaultvalue.org>
Tue, 3 Dec 2013 19:49:41 +0000 (13:49 -0600)
committerRob Browning <rlb@defaultvalue.org>
Tue, 3 Dec 2013 19:49:41 +0000 (13:49 -0600)
Compute bup_t_lib_script_home once at load time so that it won't be
affected by changes to pwd, and use it in realpath.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/lib.sh

index 0ff33a57d5bee50ccae9f0a2c042a7fc37b59fd9..93b2e598bb50b7ad62c90905c1e48f1c88d42bbf 100644 (file)
--- a/t/lib.sh
+++ b/t/lib.sh
@@ -1,5 +1,7 @@
 # Assumes shell is Bash, and pipefail is set.
 
+bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd)
+
 force-delete()
 {
     local rc=0
@@ -29,9 +31,8 @@ force-delete()
 realpath()
 {
     test "$#" -eq 1 || return $?
-    local script_home=$(cd "$(dirname $0)" && pwd)
     echo "$1" | \
-        PYTHONPATH="${script_home}/../lib" python -c \
+        PYTHONPATH="$bup_t_lib_script_home/../lib" python -c \
         "import sys, bup.helpers; print bup.helpers.realpath(sys.stdin.readline())" \
         || return $?
 }