From: Rob Browning Date: Tue, 3 Dec 2013 19:49:41 +0000 (-0600) Subject: Don't compute local script_home in lib.sh realpath (depended on pwd). X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4ff4df24744887b1a26b2d21a256f1823f3d21cd;p=packages%2Fb%2Fbup.git Don't compute local script_home in lib.sh realpath (depended on pwd). 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 --- diff --git a/t/lib.sh b/t/lib.sh index 0ff33a5..93b2e59 100644 --- 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 $? }